Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

String Related Question

  Asked By: Gin    Date: Jun 08    Category: Asp.net    Views: 1149

I have a string which is at the end containg carriage return too, I want to remove the carriage return and want to have the string without it?



7 Answers Found

Answer #1    Answered By: Anuja Shah     Answered On: Jun 08

used Is Letter or Digit while building string.

Answer #2    Answered By: Emma Campbell     Answered On: Jun 08

Just use String.Replace to get rid of the carraige return. Furthermore,
if there is only ONE carraige return  at the end, then you can use the
Left method of the string  class to get the n-1 leftmost characters of
the string, where n is the length of the string.

Answer #3    Answered By: Kellie Bishop     Answered On: Jun 08

I have 2 strings A & B, is there a function that can reply me in true or false that string  A is existing is string B as substring?

Answer #4    Answered By: Mona Wagner     Answered On: Jun 08

Yes, have a look at the IndexOf method:

<shameless plug>
For more information on the DataGrid, DataList, and Repeater controls, consider picking up a copy of my latest book:

ASP.NET Data Web Controls
</shameless plug>

Answer #5    Answered By: Eloise Lawrence     Answered On: Jun 08

MyString.Remove(MyString.Length-2, MyString.Length)

or near enough .... is what i'd use

Answer #6    Answered By: Doyle Gonzalez     Answered On: Jun 08

I have attached two text files list 1 & list 2.

List 1 has been obtained directly form a Router.

List 2 is from a table in a db.

I have to check that every username in list which is from database is present in router or not, and thers is a tricky part that a user in router list can be without @ where as in table it is with @domain and vice versa.

I have these two lists in two seperate list boxes and as before thought sorting them would be a piece ofcake as I have had hadled lists far complex than tshi involving several types of string  manipulations.

In thsi particular case I tried:
Idex of, beginswith, and eventually to wrote a routine but I couldn't get the right result, as usually missing something. If any one can help me in thsi regard, please..

I am onwith having forms in web pages, is there a shortcut to have my alraedy developed forms to be coverted to controls, so that I don't have to develop them again in the windows control library?

Answer #7    Answered By: Balbir Kaur     Answered On: Jun 08

How would I do this ...

well I'd forget about listboxes and their related  functions.
Just do it from files.

read in a line, chop it about @ and save it in a 2d arraylist (or array).

then you can use super fast code to loop and compere.

I don't really understand your criteria for what is or isn't allowed .... if the domain isn't important then just chop around @ and save the first half.

The just loop through one array checking if it exists in the other.

Or there are bubble sorts and so forth available - or there are array sorts available withinn .NET that can get rid of duplicate and so forth.

Should be pretty easy. Enjoy the exploration.

To convert a form to a control just change it to a UserControl and get rid of main, and autoscalebasesize and if you have any menus change them to context menus.
Set project to compile as as dll and voila ! Bob your uncle ! (British expresssion, soz)

Didn't find what you were looking for? Find more on String Related Question Or get search suggestion and latest updates.