473,516 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Split string to char ?

Hi guys

I have a 50 charecters long string and I need to examine every charectar individually, I thought of converting the string into and Char array of 50 and then go over the array, how can I split the string into my char array ? I do not have a delimiter between the characters in my string ( it looks like "000010100101......"
Or maybe there is a better way to examine each char (while knowing the char's position in the string) ?

Thanks !
Nov 20 '05 #1
4 6535
On Fri, 27 Feb 2004 12:01:05 -0800, =?Utf-8?B?T3JpIDop?=
<an*******@discussions.microsoft.com> wrote:
Hi guys,

I have a 50 charecters long string and I need to examine every charectar individually, I thought of converting the string into and Char array of 50 and then go over the array, how can I split the string into my char array ? I do not have a delimiter between the characters in my string ( it looks like "000010100101......")
Or maybe there is a better way to examine each char (while knowing the char's position in the string) ??

Thanks !


There's (at least) a couple of ways you can go about it..

Example 1:

Dim szText As String = "some text that you want to work on"
Dim ch() As Char = szText.ToCharArray()

... then use the ch() char array

Example 2:

Dim szText As String = "some text that you want to work on"

For Each ch As Char In szText
'Process character in ch
Next
// CHRIS

Nov 20 '05 #2
* =?Utf-8?B?T3JpIDop?= <an*******@discussions.microsoft.com> scripsit:
I have a 50 charecters long string and I need to examine every charectar individually, I thought of converting the string into and Char array of 50 and then go over the array, how can I split the string into my char array ? I do not have a delimiter between the characters in my string ( it looks like "000010100101......")


\\\
Dim c As Char
For Each c In "Hello World"
MsgBox(c)
Next c
///

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!
Nov 20 '05 #3
Ori,
In addition to the others comments, you can also use the Chars (indexed)
property of String to access individual characters.

Dim s As String
Dim ch As Char
For index As Integer = 0 to s.Length -1
ch = s.Chars(index)
Next

I normally use the other two techniques over this one, just wanted to give
you a third alternative.

Hope this helps
Jay

"Ori :)" <an*******@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
Hi guys,

I have a 50 charecters long string and I need to examine every charectar individually, I thought of converting the string into and Char array of 50
and then go over the array, how can I split the string into my char array ?
I do not have a delimiter between the characters in my string ( it looks
like "000010100101......") Or maybe there is a better way to examine each char (while knowing the char's position in the string) ??
Thanks !

Nov 20 '05 #4
Thanks guys ! works gr8 :)
Nov 20 '05 #5

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

Similar topics

4
4494
by: Daniel Pomrehn | last post by:
Hello :) I've got a string in a char* variable. This string is entered by the user and it can contain some \n Now I want to split the entered text by this char into different strings. Exists there any function to do this? The function should return e.g a char** in which each line is. Thanks in advance :)
11
29800
by: | last post by:
Hello everyone! :-D OK, I've came across many functions for this, but none works! I need one that works like this: StringSplit(string str, string delim, vector<string> results) Either with strings or char arrays, doesn't matter... anyone know? Thanks in advance!
9
2481
by: Java and Swing | last post by:
Say I have a string which contains numbers separated by a comma... such as "0,1,2,3,4,5"...I want to split the string at the commas and return an array containing, 0,1...5. Suggestions? I've tried something like... int *Split(char *msg) { int len = 0; char *tmp; char *sub_string = NULL;
5
57145
by: Vamsi | last post by:
Hi, I am trying a basic opearation of splitting a multiline value to an array of single lines(Actually making Address into AddressLine1, AddressLine2). I used Environment.NewLine in split, I could get only 1st line, but it is not returning 2nd line. here's code: string address = null; string ssep = Environment.NewLine; char sep =...
6
20746
by: andrewcw | last post by:
The split function takes as a parameter what I understand as array of Char. I can define the delimiter like this: string innerText = new string; char chSplit={'='}; innerText=tempText.Split(chSplit); But if I try this ( to make the delimiter a variable ):
14
34881
by: Ron | last post by:
Hello, I am trying to parse a string on the newline char. I guess vbCrLf is a string constant. How can I parse my string - data - on the newline char? .... data += ASCII.GetString(buffer, 0, bytesRead) .... Dim parts() As String = data.Split(vbCrLf)
3
9645
by: Ben | last post by:
Hi I am creating a dynamic function to return a two dimensional array from a delimeted string. The delimited string is like: field1...field2...field3... field1...field2...field3... field1...field2...field3...
7
2245
by: lgbjr | last post by:
Hi All, I'm trying to split a string on every character. The string happens to be a representation of a hex number. So, my regex expression is (). Seems simple, but for some reason, I'm not getting the results I expect. Dim SA as string() Dim S as string S="FBE"
1
6240
by: mdefoor | last post by:
I've written the following sample to split a string into chunks. Is this the right approach or is there perhaps a better way to accomplish getting chunks of a string? #include <stdio.h> #include <string.h> #define BUFSIZE 10 int main(int argc, char *argv) {
8
4346
by: Wijaya Edward | last post by:
Hi all, I was trying to split a string that represent chinese characters below: ??? But why the split function here doesn't seem
0
7276
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7408
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7581
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3267
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.