Questions tagged [string-parsing]

The action of retrieving data from a string

String parsing is the action of extracting or modifying data pieces from a string. For example, one might parse a string to remove all quotation marks or to find all items inside quotation marks.

970 questions
6
votes
8 answers

Separate by comma (,) and check if any of the values is = "something"

How can I somehow split/separate my JavaScript variable by comma (,). And then check if value-of-any-of-the-separated-strings = "something" For example, my variable has the value 1,2,3,4,5,6,7,8,9,10,2212312, and I want to check if any of the…
Mark Topper
  • 249
  • 1
  • 3
  • 14
5
votes
3 answers

Parse string in javascript

How can I parse this string on a javascript, var string = "http://www.facebook.com/photo.php?fbid=322916384419110&set=a.265956512115091.68575.100001022542275&type=1"; I just want to get the "265956512115091" on the string. I somehow parse this…
Robin Carlo Catacutan
  • 13,249
  • 11
  • 52
  • 85
5
votes
3 answers

Ocaml - Files and parsing

How to read contents from file in ocaml? Specifically how to parse them? Example : Suppose file contains (a,b,c);(b,c,d)| (a,b,c,d);(b,c,d,e)| then after reading this, I want two lists containing l1 = [(a,b,c);(b,c,d)] and l2 =…
priyanka
  • 923
  • 1
  • 9
  • 20
5
votes
3 answers

Parsing quoted text in java

Is there an easy way to parse quoted text as a string to java? I have this lines like this to parse: author="Tolkien, J.R.R." title="The Lord of the Rings" publisher="George Allen & Unwin" year=1954 and all I want is Tolkien, J.R.R.,The Lord of…
david
  • 51
  • 1
  • 3
5
votes
2 answers

Can access the Parse methods for a given type based on an instance of Type in C#?

I'm using a DataTable and assigning columns different types. I have a scenario where I'm receiving String data and I want to parse it based on the column's assigned type, but I can't figure out how to get to the parse methods. Is is it possible to…
Josh Russo
  • 3,080
  • 2
  • 41
  • 62
5
votes
4 answers

Java source code parser

I need to programmatically extract method definition/implementation from Java source file, could you recommend any handy library that I can use? Thanks.
eric2323223
  • 3,518
  • 8
  • 40
  • 55
5
votes
2 answers

Parsing to Free Monads

Say I have the following free monad: data ExampleF a = Foo Int a | Bar String (Int -> a) deriving Functor type Example = Free ExampleF -- this is the free monad want to discuss I know how I can work with this monad, eg. I could write some…
romeovs
  • 5,785
  • 9
  • 43
  • 74
5
votes
3 answers

How do I parse ANY Number type from a String in Java?

How do I parse ANY Number type from a String in Java? I'm aware of the methods like Integer.parseInt(myString) and Double.parseDouble(myString) but what I optimally want is a method like Number.parseNumber(myString) which doesn't exist. How can I…
Joakim
  • 3,224
  • 3
  • 29
  • 53
5
votes
2 answers

C# fails to parse NaN as a double

On a Windows PC in Japan, this line of C# throws a format exception: double d = double.Parse("NaN"); This line executes fine on my PC in the U.S. Don't know where to begin troubleshooting this one. Any thoughts? Thanks in advance, Jim
Jim C
  • 4,517
  • 7
  • 29
  • 33
5
votes
5 answers

pointers and string parsing in c

I was wondering if somebody could explain me how pointers and string parsing works. I know that I can do something like the following in a loop but I still don't follow very well how it works. for (a = str; * a; a++) ... For instance, I'm…
Robert74
  • 61
  • 1
  • 3
5
votes
2 answers

Custom parsing string

When parsing FTX (free text) string, I need to split it using + as a delimiter, but only when it's not preceded by escape character (say, ?). So this string nika ?+ marry = love+sandra ?+ alex = love should be parsed to two strings: nika + marry =…
nicks
  • 2,161
  • 8
  • 49
  • 101
5
votes
3 answers

Win32: How to convert string to a date?

In Windows, i want to parse a string as a date using an exact format string. For example, given the string "6/12/2010" and the format: "M/d/yyyy" i want to convert the string to a date, while ensuring that the date matches the format. i also need…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
5
votes
3 answers

Format specifier %n while used with sscanf is not returning the count of characters

I'm parsing a string (a char *) and I'm using sscanf to parse numbers from the string into double variables, like this: while (*s) { if (sscanf(s, " %1[MmLl] %f %f %n ", command, &x, &y, &n) == 3) { //Do some processing s += n; …
Mugunth
  • 51
  • 1
5
votes
0 answers

_wsplitpath_s() alternative to use with long paths

I'm parsing paths by using the library function _wsplitpath_s() to use with Win32 API functions. According to this MSDN document, long paths (longer than MAX_PATH characters) must be perpended with with the prefix \\?\. However, when I perpend it to…
hkBattousai
  • 10,583
  • 18
  • 76
  • 124
5
votes
6 answers

How can I get an e-mail address out of a string of key=value pairs?

How can I get some part of string that I need? accountid=xxxxxx type=prem servertime=1256876305 addtime=1185548735 validuntil=1265012019 username=noob directstart=1 protectfiles=0 rsantihack=1 plustrafficmode=1 mirrors= jsconfig=1…
noob
  • 133
  • 1
  • 9