473,324 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

String Separation

Nikky
25
I want a method to separate letter from a String .i m using .Net(C#)
example:
String-"12/12/2003"
i want -"2003" only is there any predefined function Like MID(in visual basic).
Jan 9 '07 #1
3 1299
kenobewan
4,871 Expert 4TB
Guess what?
Left, Right and Mid functions in C#

You could also use substring.

Hope that this helps.
Jan 9 '07 #2
bplacker
121 100+
I don't know about in C#, but in VB, if that value was of type Date, you could do Date.Year, which would return you 2003 in that case
Jan 9 '07 #3
I want a method to separate letter from a String .i m using .Net(C#)
example:
String-"12/12/2003"
i want -"2003" only is there any predefined function Like MID(in visual basic).
if the string above "12/12/2003" will always be in that format then you could try this.

Dim d as string = "1/9/2007"
Dim a as array = split(d, "/")

'Now we have split the date up into 3 different ordinals 1, 9, and 2007

'Next you return the last ordinal...remember indexing always starts at 0

Return a(2)


or you can do this...

Dim d As Date = "1/9/2007"
Response.Write(d.Year)
Jan 9 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jens Thiede | last post by:
Quick-Fix: Can preg_match_all return the indexes of where it matched the string? More Detail: Read carefully: I'd like to seperate a string's parts into two (2) arrays which can be subdivide...
20
by: Griff | last post by:
Hi there I'm after some suggestions as to how one might best separate form and content in a normal run-of-the-mill web application. I'm sure whole bookshelves have been written on this, but I...
0
by: Dave | last post by:
Hi, I currently have the following in order to have a little bit of horizontal spacing separation between the bullet images and the text in the list (and I'm happy with the vertical separation...
2
by: Sandeep Raje | last post by:
By default, when I start a paragraph, I get white space before the paragraph. What CSS property can I use to conrol the white space created before the paragraph. In particular, I would like to...
9
by: Danny | last post by:
HI again Is there a nifty function in access that will: 1. return the amount of occurances of a small string within a larger string? this<br>is<br>a<br>test would return 3 for <br>
7
by: Sling | last post by:
I code in Rexx on the mainframe which has 2 built-in functions: word(s,i) & words(s). word(s,i) returns the ith word in the s(tring), and words(s) returns the number of words within the s(tring)....
33
by: genc_ymeri | last post by:
Hi over there, Propably this subject is discussed over and over several times. I did google it too but I was a little bit surprised what I read on internet when it comes 'when to use what'. Most...
6
by: Andrea | last post by:
Hi, suppose that I have a string that is an hexadecimal number, in order to print this string I have to do: void print_hex(unsigned char *bs, unsigned int n){ int i; for (i=0;i<n;i++){...
1
by: dizzy77 | last post by:
A have a TextBox binded to DateTime type field and I would like the output to be formated as for example: 20/10/2007 This code below does that but it uses dots for separation: 20.10.2007...
2
by: Bart Kastermans | last post by:
Summary: can't verify big O claim, how to properly time this? On Jun 15, 2:34 pm, "Terry Reedy" <tjre...@udel.eduwrote: Thanks for the idea. I would expect the separation to lead to somewhat...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.