modernes Posted November 14, 2006 Posted November 14, 2006 Hi, I am trying to parse a string with data as follows: xxxxxxxx xxxxxxxx xxxxxxxx Name: Joe Blow xxxxxxxx xxxxxxxx (where the x's represent random data) What would be a good way to use to extract the name from the string?
/dev/null Posted November 14, 2006 Posted November 14, 2006 (edited) What would be a good way to use to extract the name from the string?StringSplit().EDIT: Oh, wait. all the lines are ONE string?CheersKurt Edited November 14, 2006 by /dev/null __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *
Paulie Posted November 14, 2006 Posted November 14, 2006 (edited) If you know how much of the random data there is on either side of the important stuff Look at the "StringTrim*"Functions If you don't know this Look at "StringRegExp" Edited November 14, 2006 by Paulie
xcal Posted November 14, 2006 Posted November 14, 2006 (edited) Just use _FileReadToArray(), run the array through a loop with an If StringInStr(),check for 'Name:', and do something if there's a match. edit - badly formed sentence. >< Edited November 14, 2006 by xcal How To Ask Questions The Smart Way
modernes Posted November 15, 2006 Author Posted November 15, 2006 StringSplit().EDIT: Oh, wait. all the lines are ONE string?CheersKurtYes, the whole thing is ONE string - would there be a way to read starting from "Name:" all the way to carriage return?
Moderators SmOke_N Posted November 15, 2006 Moderators Posted November 15, 2006 (edited) Yes, the whole thing is ONE string - would there be a way to read starting from "Name:" all the way to carriage return?Beta 3.2.1.12 ... Look at _StringBetween() and the StringRegExp option. _StringBetween($sString, 'Name\:', '\r\n', -1, 1)oÝ÷ Ù8Z¶h Ü(®AÓ©¦ÈZvØ^ Åm§$ÁªÝ°Gb·b¶nÞv¬mÂäÊj{kÊØ^±ç(¸§jبËh±ç¢~Ø^ÉÚºÚ"µÍÔÝ[Ð]ÙY[ ÌÍÜÔÝ[Ë ÌÎNÓ[YIÌLÎÌÎNË ÌÎNÉÌLÜÌÎNËLKJoÝ÷ Ù«¢+Ù}MÑÉ¥¹ Ñݸ ÀÌØíÍMÑÉ¥¹°Ìäí9µÀäÈìèÌäì°ÌäìÀäÈí¸Ìäì°´Ä°ÄoÝ÷ Ù«¢+Ù}MÑÉ¥¹ Ñݸ ÀÌØíÍMÑÉ¥¹°Ìäí9µèÌäì° I1¤oÝ÷ Ù«¢+Ù}MÑÉ¥¹ Ñݸ ÀÌØíÍMÑÉ¥¹°Ìäí9µÀäÈìèÌäì° HoÝ÷ Ù«¢+Ù}MÑÉ¥¹ Ñݸ ÀÌØíÍMÑÉ¥¹°Ìäí9µÀäÈìèÌäì°1 Edited November 15, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
mikehunt114 Posted November 15, 2006 Posted November 15, 2006 This should return "Name: Joe Blow", and everything after it into $temp, if that helps. $string = clipget() $temp = StringInStr($string, "Name: Joe Blow") $temp = StringMid($string, $temp) IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
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