fi3ldy Posted January 6, 2007 Posted January 6, 2007 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
Danny35d Posted January 6, 2007 Posted January 6, 2007 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
fi3ldy Posted January 6, 2007 Author Posted January 6, 2007 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)
herewasplato Posted January 6, 2007 Posted January 6, 2007 ...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]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now