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.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 01-21-2006, 09:35 AM   #1
Validus
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?
Validus is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-21-2006, 09:36 AM   #2
psili
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.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-21-2006, 09:40 AM   #3
Validus
Confirmed User
 
Industry Role:
Join Date: Jul 2001
Location: Calgary, Canada
Posts: 4,012
Quote:
Originally Posted by psili
Don't know ASP or C#, but here's a google result for ya:
http://www.aspmatrix.com/asp-net/str...g/substr2.aspx

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.
Validus is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-21-2006, 09:43 AM   #4
psili
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.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-21-2006, 09:44 AM   #5
psili
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.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-21-2006, 09:46 AM   #6
Validus
Confirmed User
 
Industry Role:
Join Date: Jul 2001
Location: Calgary, Canada
Posts: 4,012
Yes.. but I am working with C# not VB.
Validus is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-21-2006, 09:49 AM   #7
psili
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.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-21-2006, 09:57 AM   #8
Validus
Confirmed User
 
Industry Role:
Join Date: Jul 2001
Location: Calgary, Canada
Posts: 4,012
Quote:
Originally Posted by psili
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.


Thanks for your help!
Validus is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-21-2006, 10:01 AM   #9
RocketFlow
Confirmed User
 
Join Date: Jun 2005
Posts: 169
Quote:
Originally Posted by Validus
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?
Here is your example in C#:

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);
HTH
__________________
RocketFlow.com - Premium Hosting Services - Unrivaled Speed, Unbeatable Service
ICQ #234-583-306 or 234-628-183
RocketFlow is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-21-2006, 10:12 AM   #10
Validus
Confirmed User
 
Industry Role:
Join Date: Jul 2001
Location: Calgary, Canada
Posts: 4,012
Quote:
Originally Posted by RocketFlow
Here is your example in C#:

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);
HTH

Great, thanks to you as well... plug and play so to speak
Validus is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-21-2006, 10:16 AM   #11
RocketFlow
Confirmed User
 
Join Date: Jun 2005
Posts: 169
Quote:
Originally Posted by Validus
Great, thanks to you as well... plug and play so to speak
Indeed! Best way to help people!
__________________
RocketFlow.com - Premium Hosting Services - Unrivaled Speed, Unbeatable Service
ICQ #234-583-306 or 234-628-183
RocketFlow is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.