This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
Followers 0
omard2000

Filter Out Names From A String Result

Question

Hey guys,

 

Do any of you have an idea on how to get a certain values from a string result?

Here is an example of what I mean..

 

string names = "|Display Name:Admin|Display Name:Demo"

 

I need to get the names from the string. Any ideas?

 

Thanks! :)

Share this post


Link to post
Share on other sites

6 answers to this question

  • 0

Hi, how do you even get such string? Maybe it's better to change something in previous step where "|Display Name:" was added to this string?

 

You can use Replace:

Please login or register to see this code.

Example with splitting:

Please login or register to see this code.

 

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

Thanks for your reply @OneManArmy

I got this string as a result from a PHP script.

 

I just need to get the names separately and add them to a list or to an array. Thank you for your reply again :)

Share this post


Link to post
Share on other sites
  • 0

You can check some char to split your string :

Please login or register to see this link.

 

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

Thank you for your help! :) Your answers solved my question. :)

Share this post


Link to post
Share on other sites
  • 0

Try using json, looks like ur building ur own parser

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

That is a good suggestion, I will definitely give that a try later on. Thanks! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0