Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
missing string functions in onshape - missing in documentation
wolfgang_maier
Member Posts: 39 ✭✭✭
Hello,
missing in documentation:
Escape char '\' for strings. In onshape '\' is used but not documented.
change request:
stringToNumber( string) should accept leading/trailing whitespace chars. ' 123 ' should result in value 123.
missing string functions in onshape:
TRIM( string ) - remove leading+trailing whitespace chars from string.
LTRIM, RTRIM (string) - similar to TRIM removing leading or trailing whitespace chars
CHAR( int ) - return the character value from ascii/unicode value
SUBSTR( string, start, length ) - return a substring from string
WORD( string, n, separator ) - return the n-th word of a string. separator holds separations chars ' ,;')
CODEPAGE - return the codepage used.
MATCH2 (string, regex) - results in: hasMatch = true when substring matches the regex. [] array of matching values
Example: MATCH2("3,456,789", "([0-9]{1,3},)+"): should result in: { "captures" : [3,456,] , "hasMatch" : true }
So the analysis of parameter strings would be much easier.
Now to get the values in string "3,456,789" you need 3 lines of code to achieve the same result.
Example: replace("3,456,789", "(,[0-9]+)", "")) - cut off everything but first value.
Wolfgang
Tagged:
2