Skills | data | data type | conversion
We are in the VB data type between the conversion is very easy cstr,cint and so on functions, we all in use time should have been
is very clear, now you can use C # to do Web applications! Now we have a choice of language, plus there are really a lot of people
VB programming has a lot of do not understand: (, so they prefer to use C # programming, there are a lot of comrades stand not firm! Also want to learn to learn C #
Language (for example: Tofu. In this way, the problem of data conversion is emergent! In addition, there are conversions to string data types
First, let's look at the conversion between int and string.
Int->string, using the ToString function, let's take a look at this example 1.ToString (), for God's sake, this syntax can be identified by:
That's the C # language.
String->int has a lot of choices (actually one), such as: "12345". ToInt16 (), functions, and, of course, toint32,toint64, etc.
Similar functions, the usage is the same
How to convert a string to an array type based on a specified rule, "Http://www.asp888.net Tofu Technology Station". Split ("". Tochararay ())
How to convert a specified string to another string in a string, for example: Convert "'" to ""
We need to introduce a new Class StringBuilder here, let's take a look at this function
<script language= "C #" runat=server>
function replacestr1tostr2 (String str1,string str2,string str3) {
STR1 is the original string containing the string to replace
STR2 is the string to replace
STR3 is to replace str2 with STR3
StringBuilder d=new StringBuilder (STR1);
D=d.replace (STR2,STR3);
return d.tostring ();
}
</script>
Then we can process the "'" Symbol by REPLACESTR1TOSTR2 (str, "'", "") while processing the SQL statement! Other than that
You can also use REPLACESTR1TOSTR2 (str, "\ n", "<br>") to handle the return of the output data!!!