×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

String corollary to ug_findNumberInList()

String corollary to ug_findNumberInList()

String corollary to ug_findNumberInList()

(OP)
The ug_findNumberInList() works great for lists of numbers but I am struggling to find a similar way to search a list of string values for the position of a particular value in the list.

If I have a list expression as follows.

{"A","C","B"}

And I want to know the position of "B" in that list, how can I accomplish this task? I would want it to return a value of 2 after starting with zero for the first position.

[NX8.5.3.3]

RE: String corollary to ug_findNumberInList()

OK, there's actually on 'undocumented' function which works much better for everyone concerned (I'm working on getting it properly documented). And that is the 'Position()' function. Now it works similar to the 'ug_findNumberInList()' function except that it supports BOTH numeric and alphabetical (i.e. Stings) 'List' entries.

So for your situation, it would go something like:

My_List = {"A","C","B"}
Number = Position("B",My_List) = 3


Please note that this will return a '3' and not a '2' as would the 'ug_findNumberInList()', if it would have worked with Strings.

John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
Siemens PLM:
UG/NX Museum:

To an Engineer, the glass is twice as big as it needs to be.

RE: String corollary to ug_findNumberInList()

(OP)
thumbsup Thank you very much sir! Exactly the simple solution I was looking for.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources