Page 1 of 1

scan/substring

Posted: Wed Dec 02, 2020 1:46 pm
by samiamsz
Hey guys, I am new to coding and even newer to tm1.
I am trying to achieve this in the ti process and i knwo how to in excel
so bascally in excel if i have a list of cells that have "... : ..." and i want all the characters to the right of the ':' character i would do a right and find.
I am having trouble figuring out how to do so in the ti process. I dont need 4 or 5 or any specific amount of characters from the right, i need any amount of characters to the right of the ":"
so what i did was
sSubString = ':'
sScan = scan (sSubString, sStringVariable')
subst (sStringVariablen Long(sStringVariable) - sScan,(Not sure what to put here to get exact characters after the ':' in the string variable )

the string variable contains multiple elements each having a prefix before the ':' character and an unknown amount of characters after

am i approaching this the right way? if no, can someone give me some clarification? thank you

Re: scan/substring

Posted: Wed Dec 02, 2020 1:59 pm
by declanr
Something like below where you work out how many characters are to the right of your character should get you there.
If you start having the possibility for multiple ":" characters you would then need to look at loops to find the further right one perhaps.

Code: Select all

nPosition = Scan ( ':', sString );
sNewString = SubString ( sString, nPosition + 1, Long ( sString ) - nPosition );

Re: scan/substring

Posted: Fri Dec 04, 2020 1:54 pm
by samiamsz
thank you