Skip to main content
12-Amethyst
August 19, 2022
Solved

Mathcad Prime 8 - ORIGIN in string indexing

  • August 19, 2022
  • 3 replies
  • 1772 views

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

 

Best answer by Werner_E

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

 

 

3 replies

14-Alexandrite
August 19, 2022

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_E25-Diamond IAnswer
25-Diamond I
August 19, 2022

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

 

 

23-Emerald IV
August 22, 2022

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

 

 

 

PEAH12-AmethystAuthor
12-Amethyst
August 23, 2022

Hi all

 

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