This seems easy, but I haven’t been able to find it by searching the forum, so I’m sorry if this is something incredibly obvious… I’m working on an app where I need to compare two numbers. It’s nothing fancy, all the app needs to know is whether the two numbers are different or the same.
Basically, if they were different, variable 1 would be in the format of “#1,423,520 in blah” and variable 2 would be in the format of “#2,304 in blah”. The app would need to know whether the numbers between “#” and " in blah" are the same in both variables, or different.
Thanks in advance, and, again, sorry if this is a stupid question.
You might be thinking about how you can coerce the textual representation of a number with commas to a number. You can just remove the commas, then coerce to number or integer. e.g.
set x to “1,200,000”
set d_tid to AppleScript’s text item delimiters
set AppleScript’s text item delimiters to “,”
set temp_list to text items of x
set AppleScript’s text item delimiters to d_tid
set nx to (temp_list as string) as integer