cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Mathcad Prime 8 - ORIGIN in string indexing

PEAH
12-Amethyst

Mathcad Prime 8 - ORIGIN in string indexing

Hi everyone

 

Does anyone know if the setting of using ORIGIN in string indexing is stored in any variable? A work around would be to use one of the string functions and check what it returns.

 

PEAH_0-1660921567109.png

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:PEAH)

Here is a way to determine the index value used for the first character in a string.

It returns 0 if the option "ORIGIN in strings" is NOT checked and the value of ORIGIN otherwise.

Werner_E_0-1660932633465.png

 

 

View solution in original post

4 REPLIES 4
FredLusk
14-Alexandrite
(To:PEAH)

The variable that ORIGIN is stored in is ORIGIN.  You can use ORIGIN as an index value, etc. as in this example:

Untitled.jpg

Werner_E
25-Diamond I
(To:PEAH)

Here is a way to determine the index value used for the first character in a string.

It returns 0 if the option "ORIGIN in strings" is NOT checked and the value of ORIGIN otherwise.

Werner_E_0-1660932633465.png

 

 

LucMeekes
23-Emerald III
(To:PEAH)

Here's an expression that determines the ORIGIN used in strings, and it works in Prime Express:

LucMeekes_1-1661165646538.png

With 'ORIGIN in strings' set it produces the value of ORIGIN,

LucMeekes_5-1661166430733.png

otherwise it produces 0, regardless of the value of ORIGIN

LucMeekes_4-1661166350436.png

Note that you cannot determine the setting of 'ORIGIN in strings' in all cases by comparing ORIGIN with ORIGIN.string.

If ORIGIN=0, it may be set, or not.

 

Success!

Luc

 

 

 

PEAH
12-Amethyst
(To:LucMeekes)

Hi all

 

Thanks for all the replies. Werner's solution works, great!

Announcements

Top Tags