Do not use on any
shared computer
September 5, 2008 01:23am pdt
 
[x]
Attachment Details

Determine a space character in a string

Tags: space, string, character
I would like to write a statement that does the following but I am having alot of trouble so all the help is appreciated.

The statement will:
take a string of (x character's) size to be determined by running program from a variable (such as Description)
break it down into 40 character segments
Reverse from 40 to a space ??? I am unsure on how to do that.
Print the number of characters from 1 to the character with a space.
Be contained in a loop so that I can pick up from the space and pick up another 40 characters.

Any help is greatly appreciated.  
Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Microsoft
Question Asked By: mlupino
Solution Provided By: Sancler
Participating Experts: 2
Solution Grade: A
Views: 33
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by shahprabal

Rank: Master

Expert Comment by shahprabal:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by Sancler

Rank: Genius

Accepted Solution by Sancler:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by mlupino
Author Comment by mlupino:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Open Discussion
Open Discussion
 
Comment by mlupino
I am having some trouble validating the code is working OK. It is probably me. I wanted to test it under a different condition, by adding a textbox1.text output to each broken string. I think seeing that may help me. I created six different textboxs from textbox1.text to textbox6.text to represent a maximum of 240 characters entered in as input. Would you be able to show me how to output the result of the split strings to text boxes. Any help would be appreciated. If you'd like i can open another question on the topic so you can get additional points.
 
 
Comment by Sancler
The simplest way to test is to use a single TextBox with its .MultiLine property set to True and then use code like.

        <myTextBox>.Text = SetLineLength(<TestText>, 40)

where myTextBox is the name of your textbox and TestText is the string you want breaking up.

If you want to put each line in a spearate textbox it becomes more complicated.  Basically you need to split up the string that is returned by the function

        Dim newlines() As String = Regex.Split(SetLineLength(<TestText>, 40), vbCrLf)

and then put each element of that newline array into one of the textboxes

        TextBox0.Text = newlines(0)
        TextBox1.Text = newlines(1)
        'etc

That's easy enough, hard-coding.  But the complications come in (a) that in real life you won't know how many elements there will be in the array and (b) that there is no direct method of coding the equivalence

        TextBox? = newlines(?)

where ? represents an index number.  If you want to go down that latter line I think a new question would be appropriate as it's really a different topic from that of splitting up the string.

Roger
 
 
20080723-EE-VQP-34 / EE_QW_2_20070628