Google Brother Up

Showing posts with label String. Show all posts
Showing posts with label String. Show all posts

2008/12/19

Split a string separated by ";" and place in an array

How to split a string like this ";1;2;3;4;5;6" and put in on an array?

string mstrStream = mstrSelectedRowsStream.Remove(0,1); // to remove the semicolon on the extreme left

char chSep = ';';
string[] arrStr = mstrStream.Split(chSep);


How to get each number back from that array?

for (int i = 0; i <>
{
     string s = arrStr[i].ToString();
}

145 unique visitors

2008/12/12

Convert a string to Proper Case or Sentence Case

using System.Globalization;

CultureInfo cc = new CultureInfo("");
TextInfo ti = cc.TextInfo;
ti.ToTitleCase(mlstSelectedColumn
.ColumnDataTypeCSharp)

143 unique visitors

2008/03/04

Convert from String to Float in C#

There are 2 ways: -

1) String to Double to Float (indirectly)
fc.Price = (float)Convert.ToDouble(txtPrice.Text);

2) String to Float (directly)
fc.Price = float.Parse(txtPrice.Text);

Drop Down List

1. http://www.janetsystems.co.uk/Articles/NetArticles/tabid/74/itemid/161/modid/449/Default.aspx