473,395 Members | 1,694 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,395 software developers and data experts.

Getting last 9 digits from a string

Hi there

I need to return the last 9 characters from a string, no matter what characters there are before it. Tried this:

Expand|Select|Wrap|Line Numbers
  1. string id = HttpContext.Current.User.Identity.Name.ToLower().Remove(id.Length - 9);
But it doesn't do the trick. And I can't see what it's returning as debug is not hitting the breakpoint.

Please help
Matt
Jun 25 '09 #1
2 3631
IanWright
179 100+
If your debugger isn't hitting the breakpoint, it suggests the line isn't being executed...

Add a Debug.WriteLine("Message") before the line and see if this gets churned out to the output window. If not then you have a different problem to fix first.
Jun 25 '09 #2
Curtis Rutland
3,256 Expert 2GB
I'd say something like this:
Expand|Select|Wrap|Line Numbers
  1. string id = HttpContext.Current.User.Identity.Name.ToLower();
  2. if(id.Length > 9)
  3.   id = id.Substring(id.length - 9, 9);
Jun 25 '09 #3

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

Similar topics

14
by: Westcoast Sheri | last post by:
What is the most efficient way of extracting the first two digits in a string? The following is wrong for me, because it only gives me the first instance of two digits together: $string =...
4
by: Anon | last post by:
Hello All! I have written a simple app that auto downloads a file from a secure ftp, renames it, and moves it to a network location. Everything works great except the renaming part. I parse out...
5
by: Bill | last post by:
Hello, Could anyone post some simple code or advise me on how I can display the SSN number like *****7890 in a text box, even thought the user entered 1234567890, and the value of the variable...
1
by: UJ | last post by:
Do anybody have any code to grab the Windows XP CD Key ? TIA - Jeff.
109
by: jmcgill | last post by:
Hello. Is there a method for computing the number of digits, in a given numeric base, of N factorial, without actually computing the factorial? For example, 8! has 5 digits in base 10; 10! has...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I format Last Modified date with javascript...
6
by: bill | last post by:
I have been presented with the task of getting the last file from a linux directory when the files are of the form: nnnnnn-xxxxxxx-.ext where nnnnnn are 6 numeric digits and xxxxxx is variable...
2
by: dhutton | last post by:
How would one go about grabbing just the last 5 digits of a 16 digit number - then prefixing the last 5 numbers with 99800 so if the number is 8351101100000029 I need my SQL (Microsoft) to grab...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.