|
|
|
||||
|
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
Confirmed User
Industry Role:
Join Date: Jul 2001
Location: Calgary, Canada
Posts: 4,012
|
ASP.NET C# Question
Thought I?d ask here, maybe some body knows.
I want to shorten the value of a string to 50 characters. Any tips? Kind of like substr() in PHP? |
|
|
|
|
|
#2 |
|
Confirmed User
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
|
Don't know ASP or C#, but here's a google result for ya:
http://www.aspmatrix.com/asp-net/str...g/substr2.aspx
__________________
Your post count means nothing. |
|
|
|
|
|
#3 | |
|
Confirmed User
Industry Role:
Join Date: Jul 2001
Location: Calgary, Canada
Posts: 4,012
|
Quote:
Ah thanks a lot. Unfortunately it is VB not C#. I?ve been looking for a while now? just can?t seem to find anything. I must be on the wrong path. |
|
|
|
|
|
|
#4 |
|
Confirmed User
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
|
It must be the same, since most low-level functions are across languages.
Don't know where to search, but I'm sure VB has a "substring" function, where you put start position and end position. Edit: google knows all: Dim aString As String = "SomeString" Dim bString As String bString = Mid(aString, 3, 3)
__________________
Your post count means nothing. |
|
|
|
|
|
#5 |
|
Confirmed User
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
|
BTW, I've only played with VB a little bit and I can say I already hate that fucking language. But that's just personal opinion.
__________________
Your post count means nothing. |
|
|
|
|
|
#6 |
|
Confirmed User
Industry Role:
Join Date: Jul 2001
Location: Calgary, Canada
Posts: 4,012
|
Yes.. but I am working with C# not VB.
|
|
|
|
|
|
#7 |
|
Confirmed User
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
|
K then.
Done with helping this fucked up thread. I reply with an "ASP.NET C#" answer, and you say you're working in "VB". I reply with a "VB" solution and you say you're working in "C#". Do you know what the fuck you're doing, or am I just getting grumpy because I don't understand the question? btw, here's the C# example: String myString = "abc"; bool test1 = String.Compare(myString.Substring(2, 1), "c") hahahaha 0; // This is true. myString.Substring(3, 1); // This throws ArgumentOutOfRangeException. bool test2 = String.Compare(myString.Substring(3, 0), String.Empty) hahahaha 0; // This is true.
__________________
Your post count means nothing. |
|
|
|
|
|
#8 | |
|
Confirmed User
Industry Role:
Join Date: Jul 2001
Location: Calgary, Canada
Posts: 4,012
|
Quote:
Thanks for your help! |
|
|
|
|
|
|
#9 | |
|
Confirmed User
Join Date: Jun 2005
Posts: 169
|
Quote:
Code:
String myLongString = "This is a very long text. This is a very long text. This is a very long text. This is a very long text. This is a very long text. This is a very long text. This is a very long text. "; String myShortString = myLongString.Substring(0, 50);
__________________
RocketFlow.com - Premium Hosting Services - Unrivaled Speed, Unbeatable Service ICQ #234-583-306 or 234-628-183
|
|
|
|
|
|
|
#10 | |
|
Confirmed User
Industry Role:
Join Date: Jul 2001
Location: Calgary, Canada
Posts: 4,012
|
Quote:
Great, thanks to you as well... plug and play so to speak |
|
|
|
|
|
|
#11 | |
|
Confirmed User
Join Date: Jun 2005
Posts: 169
|
Quote:
__________________
RocketFlow.com - Premium Hosting Services - Unrivaled Speed, Unbeatable Service ICQ #234-583-306 or 234-628-183
|
|
|
|
|