473,513 Members | 2,440 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i want to know what the following function is doing?

hi,

Please tell me what the below mentined code is doing? If i pass String
s as my name is "xyz. and " i am writing . what should be the output.

Thanks in advance

void parse(Block<String>& f, String s)
{
int inquote = 0;
int nf = 0;
int start = -1;
for(int i = 0; i <= length(s); i++){
if(i == length(s) || (isspace(s[i]) && !inquote) || (s[i] == '"' &&
inquote)){
if(start != -1){
nf++;
f.reserve(nf);
if(inquote && i != length(s))
f[nf-1] = s(start,i-start+1);
else
f[nf-1] = s(start,i-start);
start = -1;
inquote = 0;
}
}

else if(start == -1){
start = i;
inquote = (s[i] == '"');

}
}
f.size(nf);
}
Jun 27 '08 #1
0 1158

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1581
by: hazz | last post by:
The following classes follow from the base class ' A ' down to the derived class ' D ' at the bottom of the inheritance chain. I am calling the class at the bottom, "public class D" from a client...
4
1252
by: Fredrik Melin | last post by:
I have the following code that I get "Cannot convert from DacsaSupport.Inventory to DacsaNET.Inventory" Public Function RetrieveItem(ByVal Product_ID As String) As Inventory Dim...
182
7356
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
3
2634
by: Dean Craig | last post by:
I'm working with the new ASP.NET AJAX Control Toolkit. I have a map that has several key areas (hot spots) where when the user hovers over them, I want to pop up a small window with information in...
14
2264
by: Professor Yonce | last post by:
I have made form for E-Mail. I have entered code but the Import system does not work. It has squiggly line underneath it showing it is not communicating. It Will not build. Public Class...
4
2078
by: Mark | last post by:
Hey folks, I'm looking at making the following query more efficient potentially using the ranking functions and I'd like some advice from the gurus. The purpose of the following is to have a...
12
3810
by: MrHelpMe | last post by:
Hello again all, I've finished my whole application and now I don't like the whole session variables that I am using. I have a form, user fills in info clicks submit and using CDOSYSMail an...
33
15462
by: Michael B Allen | last post by:
Hello, Early on I decided that all text (what most people call "strings" ) in my code would be unsigned char *. The reasoning is that the elements of these arrays are decidedly not signed. In...
23
9339
by: Maarten | last post by:
Howdy, Recently I switched from a Windows PC to Mac OS-X 10.5 (php v5.2.6) and I have a little problem with one function within my cd-management script. For extracting a bit of info from my...
0
7264
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
7166
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7386
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
7543
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...
1
7106
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7534
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5094
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1601
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.