Regex.Replace Method
Within a specified input string, replaces strings that match a regular expression pattern with a specified replacement string.
ex.
// assigning value into the string xvalue.
string xvalue = "199 RemoveText";
// removing character and leave numbers
decimal value = (decimal)Regex.Replace(xvalue, @"[\D]", "");
//As the result:
199
Features
Thursday, June 26, 2008
Monday, May 26, 2008
How to store and retrieve cookie C#
cookie["Name"] = "Kiko Salva"
cookie.Expires = DateTime.Now.AddYears(1);
Response.Cookies.Add(cookie);
// To retrieve
lblName.Text = "Cookie Created.";
lblName.Text += "New Customer: " + cookie["Name"];
cookie.Expires = DateTime.Now.AddYears(1);
Response.Cookies.Add(cookie);
// To retrieve
lblName.Text = "Cookie Created.";
lblName.Text += "New Customer: " + cookie["Name"];
Category
C#
Tuesday, May 13, 2008
How to split in c#
private void SplitNo()
{
// string seperated by colons ';'
string items = "1--->;2--->;3--->;4--->;5--->";
string[] collection = new string[4];
// define which character is seperating fields
collection = items.Split(';');
for (int x = 0; x < collection.Length; x++) { Response.Write(collection[x] + "
");
}
}
-----------------------------------------------------------
Sample Output:
1--->
2--->
3--->
4--->
5--->
{
// string seperated by colons ';'
string items = "1--->;2--->;3--->;4--->;5--->";
string[] collection = new string[4];
// define which character is seperating fields
collection = items.Split(';');
for (int x = 0; x < collection.Length; x++) { Response.Write(collection[x] + "
");
}
}
-----------------------------------------------------------
Sample Output:
1--->
2--->
3--->
4--->
5--->
Category
C#
REPLACE (Transact-SQL)
Replaces all occurrences of a specified string value with another string value.
ex.
Url Value = "http://www.samplewebsite.com/left/right/getch/"
I want to remove the http://www.samplewebsite.com/ and change it to http://www.minewebsite.com/
Query Sample :
update tbl_URLs set url = replace(url,'http://www.samplewebsite.com/','http://www.minewebsite.com/')
the output must be:
http://www.minewebsite.com/left/right/getch/
Hope this will help.
ex.
Url Value = "http://www.samplewebsite.com/left/right/getch/"
I want to remove the http://www.samplewebsite.com/ and change it to http://www.minewebsite.com/
Query Sample :
update tbl_URLs set url = replace(url,'http://www.samplewebsite.com/','http://www.minewebsite.com/')
the output must be:
http://www.minewebsite.com/left/right/getch/
Hope this will help.
Category
SQL query
Move Image to new destination in vb.net
The System.IO namespace contains types that allow synchronous and asynchronous reading and writing on data streams and files.
--------------------------------------------------------------------------------
// First you need to declare this on first
Imports System.IO
// I created a function called CopyFile
// Source = "c:/images/1.jpg"
// destination = "c:/move/1.jpg"
Private Sub CopyFile(ByVal source As String, ByVal destination As String)
My.Computer.FileSystem.CopyFile(source, destination, False)
End Sub
--------------------------------------------------------------------------------
Hope this help. Thank you.
--------------------------------------------------------------------------------
// First you need to declare this on first
Imports System.IO
// I created a function called CopyFile
// Source = "c:/images/1.jpg"
// destination = "c:/move/1.jpg"
Private Sub CopyFile(ByVal source As String, ByVal destination As String)
My.Computer.FileSystem.CopyFile(source, destination, False)
End Sub
--------------------------------------------------------------------------------
Hope this help. Thank you.
Category
vb.net
Debugging Javacript on Firefox
Tips on debugging HTML, CSS, and JavaScript in Mozilla Firefox. It cover a number of concept such as using the console, Interactive debugger and timer features of the firefug extension for firefox.
======================================
Click here
======================================
======================================
Click here
======================================
Category
css
Tuesday, April 8, 2008
Setup localhost SMTP virtual Server
1.) Start -> run -> Type "Inetmgr"
2.) Right click Default SMTP Virtual Server
3.) Goto Tab Access
4.) Click Relay button Then click Add button
5.) Click single computer option type on the IP address enter "127.0.0.1" or localhost
6.) then click Ok
2.) Right click Default SMTP Virtual Server
3.) Goto Tab Access
4.) Click Relay button Then click Add button
5.) Click single computer option type on the IP address enter "127.0.0.1" or localhost
6.) then click Ok
Category
IIS
Subscribe to:
Posts (Atom)