473,387 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to parse values from string

I have function that returns this big string and it has all the values i need. How do i do parsing to get each value.

stdClass Object (
[cameraConfig] => stdClass Object (
[videoproperties] => stdClass Object(
[brightness] => stdClass Object ([mode] => 0 [value] => 20 )
[contrast] => stdClass Object ( [mode] => 0 [value] => 20 )
[hue] => stdClass Object ( [mode] => 0 [value] => 20 )
)


I want to get the values like brightness and contrast and hue values and also the mode values.

Example would be great...

Please help , Thanks
Jun 26 '08 #1
2 1301
vikas251074
198 100+
You use a unique delimiter to split any text(big or small).

But you should know what seperates each item. Here suppose comma is a seperator then

Expand|Select|Wrap|Line Numbers
  1. var resp = object;
  2. respArr = resp.split(",");
  3. // now respArr[0] contains value of "cameraconfig",  respArr[1] contains value of "videoproperties", respArr[2] contains value of  "brightness"  .... and so on.
  4.  
This may help you

Regards,
Vikas
Jun 27 '08 #2
acoder
16,027 Expert Mod 8TB
Yes, split is the method you're looking for and you can use a regular expression too to decide what to split on. However, I'd say it's better to make things easier by getting the function to return something more easily parse-able.
Jun 27 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: N | last post by:
Hi, I would like to parse out each value that is seperated by a comma in a field and use that value to join to another table. What would be the easiest way to do so without having to write a...
22
by: Ram Laxman | last post by:
Hi all, I have a text file which have data in CSV format. "empno","phonenumber","wardnumber" 12345,2234353,1000202 12326,2243653,1000098 Iam a beginner of C/C++ programming. I don't know how to...
3
by: Ken Bush | last post by:
How can I write an update query that removes part of a field? Like if I have a field with values such as 8/3/68 (a birthday obviously) and I need to put values in a new column but I need...
5
by: tony collier | last post by:
I have ..... enum day {monday, tuesday, wednesday}; myArray=5; i=(int)Enum.Parse(typeof(day), wednesday);
5
by: Navid Azimi | last post by:
What's the best way to parse a currency string to a decimal given the possibility of multiple currencies? That is, my numeric string can be ($12.00) or -£12.00; in either case I want -12.00 to be...
9
by: Python.LeoJay | last post by:
Dear all, i need to parse billions of numbers from a file into float numbers for further calculation. i'm not satisfied with the speed of atof() function on my machine(i'm using visual c++ 6)....
5
by: BMeyer | last post by:
I have been losing my mind trying to parse an XML document (with nested child elements, not all of which appear in each parent node) into a DataGrid object. What I want to do is "flatten" the XML...
6
by: trevor | last post by:
Incorrect values when using float.Parse(string) I have discovered a problem with float.Parse(string) not getting values exactly correct in some circumstances(CSV file source) but in very similar...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
2
by: shapper | last post by:
Hello, I have the following class ( Level is just a simple enumeration ): public class Theme { public Subject Subject { get; set; } public List<LevelLevels { get; set; } public string Note {...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.