How Can I replace the first character of the string

Hi all,

I want to find and replace to first character of the string.I used all replace functions but i don’t find the any answer for my question.

For example; my string is : /Baris/Pega/dev I want to replace “/” to “” the first character but replaceAll function replace all “/” characters. I tryed to use startsWith funtion with replaceAll functions but it doesnt work.Like this:

if(@String.startsWith(.PushMessageBody,“/”),@replaceAll(.PushMessageBody,“/”,“”),.PushMessageBody)

Thank you.

@Baris_ERENLER you can make use to substring function for this. Please try and let me know.

@Anoop Krishna Substring function gives the first character of the string,how can combine the functions for the change just first character of the string.

@Baris_ERENLER you can try this- get first character using length function and substring function. Then after that you can store the remaining part of the string using whatcomesafter or substring. Now we have 2 parts of string, 1st letter and remaining part. Now replaceall to the first part.

Then again append 1st and 2nd strings.

@Baris_ERENLER

Hi

You can use @whatComesAfterFirst(“/Baris/Pega/dev”,‘/’)

Hi All,

Thank you for your Supports. @Anoop Krishna According to your advices,Firstly I used startsWith function if it is true than used substring funciton like this;

@if(@String.startsWith(.PushMessageBody,“/”),@String.substring(.PushMessageBody,1),.PushMessageBody) it’s worked.

On the other hand,@LANH(ラン) I tried yours function,it’s worked.

Thank you for all.

@Baris_ERENLER

Instead of Substring we can use whatComesAfterFirst after function it is straight forward approach.

Thanks