Sign in to follow this  
Followers 0
fi3ldy

String Problem :(

4 posts in this topic

ok, basically i have a file which contains information which looks like: 1|username|435m345nm435b345

Im attempting to get the "1", the very first character, except i cant just StringTrimRight because the "1" could go to 2 characters, such as "22" or "356", i basically have to cut it off and get the chracter(s) before the first |

If anybody could help it would be very appriciated!

this has mind boggled me :P

Share this post


Link to post
Share on other sites



Look at the help file for StringSplit()

Example:

$Information = StringSplit('1|username|435m345nm435b345', '|')

That will give you:

$Information[0] = 3

$Information[1] = 1

$Information[2] = username

$Information[3] = 435m345nm435b345


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

Look at the help file for StringSplit()

Example:

$Information = StringSplit('1|username|435m345nm435b345', '|')

That will give you:

$Information[0] = 3

$Information[1] = 1

$Information[2] = username

$Information[3] = 435m345nm435b345

Thanks alot (L)

Share this post


Link to post
Share on other sites

...except i cant just StringTrimRight because the "1" could go to 2 characters, such as "22" or "356",...

$str = "1|username|435m345nm435b345"
$trimmed = StringLeft($str, StringInStr($str, "|") - 1)
MsgBox(0, "", $trimmed)

$str = "22|username|435m345nm435b345"
$trimmed = StringLeft($str, StringInStr($str, "|") - 1)
MsgBox(0, "", $trimmed)

$str = "356|username|435m345nm435b345"
$trimmed = StringLeft($str, StringInStr($str, "|") - 1)
MsgBox(0, "", $trimmed)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0