Pat Stanford Posted January 16, 2020 Share Posted January 16, 2020 I think my archive might have gotten too big, because I am sure this has been discussed before, but I can't find it. The basic question is: How can you right a script that will run anywhere if it depends on how things are delimited. In the US we use a period (.) as the decimal point. In many other countries it is a comma (,). In the US we use a comma (,) as the separator in a CSV file, in Europe it is a semicolon (;) I am considering a script that will read the formula out of a worksheet cell [=record.field format] and then I want to be able to extract the record name and field name. I can do that relatively easily using Copy, Pos, and SubString, but only if I am certain what the delimiter character between the two parts of the field are. Is it always a period? Or is it a comma in some languages/countries? Since I think this is actually based on the operating system settings, it is not even a easy as having different versions for different countries as someone could set their OS up differently. How do I determine what delimiters are used or how do I write a script that is delimiter independent? I think I was bitten by this in the last couple of weeks where a script I posted had to have the commas changed to semicolons but I can't find that thread either. Grrrrr. OK Gurus what am I missing to make this work? Quote Link to comment
Peter Vandewalle Posted January 16, 2020 Share Posted January 16, 2020 You’re right about the delimiters when it comes to numbers. But for records/fields in Vectorworks worksheets the delimiter is always a period. Quote Link to comment
r.cipriani Posted January 16, 2020 Share Posted January 16, 2020 3 hours ago, Pat Stanford said: I think I was bitten by this in the last couple of weeks where a script I posted had to have the commas changed to semicolons but I can't find that thread either. Grrrrr. Was the script you posted in my thread “insert values referred to Working Plane in a Worksheet” I am under the impression that if you send a .vwx file containing the script the separators are always correct. Quote Link to comment
Art V Posted January 16, 2020 Share Posted January 16, 2020 This could probably be solved by VW (allow for) using a tab delimiter as that is probably the delimiter least likely to cause issues in CAD software where delimited lists are involved. Quote Link to comment
JBenghiat Posted January 16, 2020 Share Posted January 16, 2020 You can probably sleuth out the decimal indicator by parsing the result of a Num2Str conversion. In the case of a worksheet formula however, this is a proprietary syntax and I’m fairly sure it doesn’t get localized. Quote Link to comment
Pat Stanford Posted January 16, 2020 Author Share Posted January 16, 2020 Thank you all for the input. I think that is enough for me to move on. For now. Best Regards. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.