473,399 Members | 3,888 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,399 software developers and data experts.

Right & Left

Hello,

What are the equivalent functions for Right and Left in c#?

Thanks, sck10
Aug 28 '06 #1
3 1494
"sck10" <sc***@online.nospamwrote in message
news:OI**************@TK2MSFTNGP02.phx.gbl...
What are the equivalent functions for Right and Left in c#?
http://www.tangiblesoftwaresolutions...%20Methods.htm
Aug 28 '06 #2
Hi,

You have two options:

1. Reference Microsoft.VisualBasic and use the static methods from class
Strings:

Strings.Left()
Strings.Right()
Strings.Mid()

2. Use Substring:

string s = "Hello World";
s.Substring(0, 5) -Left(s, 5)
s.Substring(s.Length - 5, 5) -Right(s, 5)
s.Substring(3, 2) -Mid(s, 4, 2)

Watch out for the last Mid equivalent in C#, Mid() in Visual Basic is
using one-based index, while Substring should use zero-based index.

Hope this helps. Please feel free to post here if anything is unclear.

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 29 '06 #3
Thanks Steven...
"Walter Wang [MSFT]" <wa****@online.microsoft.comwrote in message
news:zE*************@TK2MSFTNGXA01.phx.gbl...
Hi,

You have two options:

1. Reference Microsoft.VisualBasic and use the static methods from class
Strings:

Strings.Left()
Strings.Right()
Strings.Mid()

2. Use Substring:

string s = "Hello World";
s.Substring(0, 5) -Left(s, 5)
s.Substring(s.Length - 5, 5) -Right(s, 5)
s.Substring(3, 2) -Mid(s, 4, 2)

Watch out for the last Mid equivalent in C#, Mid() in Visual Basic is
using one-based index, while Substring should use zero-based index.

Hope this helps. Please feel free to post here if anything is unclear.

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Aug 29 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: PJ | last post by:
http://www.paulwalker.tv/test.htm I want the Asset List title to float to the left in the cell and the <select> and <input> elements to float to the right. However, in Mac IE, the <select> and...
4
by: erikd | last post by:
I'm trying to set up a standard "footer" on my pages. I just discovered by reading this newsgroup that straight html is no good and I need to learn how to do it using css. So I while I'm learning...
2
by: sylvian stone | last post by:
Hi, I'm trying to do something that has always been easy with tables - namely use a three column layout, and above the main layout, show three images - one on the absolute left, one on the absolute...
17
by: orekinbck | last post by:
Hi There Say I want to check if object1.Property1 is equal to a value, but object1 could be null. At the moment I have code like this: if (object1 != null) { if (object1.Property ==...
1
by: Fred Nelson | last post by:
I'm a newby and I'm writing my first VB.NET print program! I need to change the default left and right margins for my printed output "e" is my "System.Drawing.Printing.PrintPageEventArgs By...
1
by: neoswf | last post by:
hi all i have this function: -- function userNameValidChars(e) { if (!e) var e = window.event; if (e.keyCode) key = e.keyCode; else if (e.which) key = e.which; if(!(key==37) && !(key==39))...
5
by: Timeri | last post by:
This is a bit confusing until you actually see what I'm talking about but the main content of my page is not growing with the right column. I want the main content (left/larger column) to take into...
2
by: bleslie | last post by:
Having a bit of a problem i need to extract the state code out of a field formated like this. WEST BEND, WI 53095 I've managed to get the city and zip code in sperate fields using the right...
3
by: Noorain | last post by:
I designed a site. i want to header,footer,left & right column fixed but body information only scrolling. this site screen to be 800/600 px. i designed this way but when i used position fixed all...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.