jvanegmond Posted April 12, 2006 Posted April 12, 2006 (edited) I'm looking to replace all zero's on the left hand side Example: Input: 000018FE Output: 18FE Input: 000108F0 Output: 108F0 I've looked at StringRegExp but my mind overloaded so i'm looking for a bit of assistance Edited April 12, 2006 by Manadar github.com/jvanegmond
jvanegmond Posted April 12, 2006 Author Posted April 12, 2006 Awesome! This works Thanks a lot Larry! github.com/jvanegmond
Moderators SmOke_N Posted April 12, 2006 Moderators Posted April 12, 2006 (edited) Here you go... MsgBox(0, '', _RemoveDigit("018FE", 0)) Func _RemoveDigit($v_String, $i_Digit) If StringInStr($v_String, String($i_Digit)) Then For $i_count = 1 To StringLen($v_String) If StringMid($v_String, $i_count, 1) <> $i_Digit Then Return StringTrimLeft($v_String, $i_count - 1) Next EndIf Return $v_String EndFunc Edit: Damn I'm slow today! Edit2: Had to modify mine, so it counted the number as a string. Edited April 12, 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.
CyberSlug Posted April 12, 2006 Posted April 12, 2006 (edited) Larry's should work, but here's an alternative. $input = "000018FE" $output = StringFormat ("%X", Dec($input)) MsgBox(0, "Result", $output) ;Similar to Larry's Func _shorterFunction($input) Local $i For $i = 1 to StringLen($input) If StringMid($input, $i, 1) = "0" Then ContinueLoop Return StringMid($input, $i) Next EndFunc Edit: made $i Local for correctness... Edited April 12, 2006 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
CyberSlug Posted April 12, 2006 Posted April 12, 2006 In my unbiased opinion, I'd say that StringFormat is the winner Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
jvanegmond Posted April 12, 2006 Author Posted April 12, 2006 Thanks for the feedback guys, you can stop now github.com/jvanegmond
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