Domitan Redenblack Posted June 13, 2011 Share Posted June 13, 2011 What do you think is the best way to "alpha-numericize" a string?That is, strip all chars except <space>, A_Z, a-z, and 0-9Or, more generally, have a string of allowable chars 'sKeepChars' ?Use a loop through the string and lookup each char of it in the sKeepChars?Any more clever ways for LSL to do it? ty Link to comment Share on other sites More sharing options...
rebands Posted June 13, 2011 Share Posted June 13, 2011 i like strippping and having sex Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 13, 2011 Share Posted June 13, 2011 Take a look at this user defined function in the wiki. It may be a nice place to start. At the very least, it can tell you whether it's even necessary to iterate though an entire string to strip out the non-alphanumerics. With a little tweaking, it could become your cleaning function too. Link to comment Share on other sites More sharing options...
Void Singer Posted June 14, 2011 Share Posted June 14, 2011 I use a validation technique in my calculator that may be helpful. it doesn't actually strip characters, but it does provide the potential to do so be eliminating all valid characters in a temp string leaving only invalid ones.. I take a sting, make a temp copy. the temp copy is parsed to list, removing 8 valid characters as discarded separators, then the list is cast back to string the process is repeated for each 8 characters to remove, until all valid characters are removed. if anything is left, it's an invalid character or characters, and could be used to eliminate them from the original string... the relevant part can be found at the beginning of this script (first four lines after variable declaration) Link to comment Share on other sites More sharing options...
Domitan Redenblack Posted June 14, 2011 Author Share Posted June 14, 2011 I ended up just doing a loop one orig char at a time, checking to see if it is in string " ABCDEFGHIJKLMNOPQRSTUVWXYZabcde.... etc" that works fine thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now