Change spefic value of a char in a string with index position

Change spefic value of a char in a string with index position

info
Contributor Contributor
687 Views
2 Replies
Message 1 of 3

Change spefic value of a char in a string with index position

info
Contributor
Contributor

Hi , I search on forum and study the MacroProgrammingGuide.pdf BUT

I couldn't find what I'm looking for.

 

My not working macro is:

STRING  $name = "ABC"

MESSAGE INFO $name[2]

 

Why is not printing the second char?

How can I replace the second char?

I don't need to replace a spefic char but the specific position in the string

 

Thank you in advice.

0 Likes
Accepted solutions (1)
688 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

STRING  name = "ABCDEF"
MESSAGE INFO substring($name,1,1)
$name=substring($name,0,1)+'X'+substring($name,2)
MESSAGE INFO $name

0 Likes
Message 3 of 3

TK.421
Advisor
Advisor

all the string functions are under Help, Documentation, Parameters, Reference.  scroll down to functions. you'll find a list and examples of everything you're able to do in the powermill macro language (which is quite a bit).

Capture.PNG


the numbers never lie
0 Likes