![]() |
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? |
Don't know ASP or C#, but here's a google result for ya:
http://www.aspmatrix.com/asp-net/str...g/substr2.aspx |
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. |
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) |
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.
|
Yes.. but I am working with C# not VB.
|
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. |
Quote:
Thanks for your help! |
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. "; |
Quote:
Great, thanks to you as well... plug and play so to speak :) |
Quote:
|
| All times are GMT -7. The time now is 10:25 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123