473,667 Members | 2,562 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

poor string function

why c# function for string manupolation is not as strong as other languages
,for extracting a substring from a middle of another string ,I have a lot of
problems.

Any suggestion or I am in the wrong spot.
Thanks
Nov 16 '05 #1
11 1535
What problem are you having? Does the SubString method not work?

-Rob Teixeira

"ALI-R" <al*@microsoft. com> wrote in message
news:%2******** *******@TK2MSFT NGP10.phx.gbl.. .
why c# function for string manupolation is not as strong as other languages ,for extracting a substring from a middle of another string ,I have a lot of problems.

Any suggestion or I am in the wrong spot.
Thanks

Nov 16 '05 #2
What's wrong with "Substring" ?

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #3
hi.....

seems like a heated debate on this topic, count me in.......

if u cud say the issue, probably we can give you some solutions or may be
suggestions.... .

Kannan.V

"David Anton" wrote:
What's wrong with "Substring" ?

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 16 '05 #4
ALI-R <al*@microsoft. com> wrote:
why c# function for string manupolation is not as strong as other languages
C# itself has almost *no* string manipulation at all. The .NET
framework has plenty though. That's the way it should be, IMO.
for extracting a substring from a middle of another string ,I have a lot of
problems.


That sounds like your problem rather than the framework's or C#'s, but
perhaps if you could tell us more about the problems you're having, we
could help you. Here's an example of getting a substring:

string x = "abcdefg";
string y = x.Substring (2, 3);

y is now "cde" - 3 characters, starting from position 2 ('c') of x.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #5
Why dont u use regular expressions....
Nov 16 '05 #6
Because they're slower, and unnecessary if you already know the position in
the string you want to extract from. But if you don't, then you should use
them.

"darin" <da***@discussi ons.microsoft.c om> wrote in message
news:2E******** *************** ***********@mic rosoft.com...
Why dont u use regular expressions....

Nov 16 '05 #7
<"Bonj" <benjtaylor at hotpop d0t com>> wrote:
Because they're slower, and unnecessary if you already know the position in
the string you want to extract from. But if you don't, then you should use
them.


Again, not necessarily. If you want to get the rest of the string from
the first colon onwards, using a regular expression seems over the top
to me when IndexOf and Substring will do the trick perfectly easily.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #8
Seems to be stimulating your sense of proud self-confidence on C#
capability in string manipulation,ok here we go,GET FIGHTED:
I have a string like string pathFolder=
"http://serverdev.hag.n et/Operation/Document Library"

I want to split it into these three segments:
1) "http://serverdev.hag.n et"
2)"Operation"
3)Document Library

I did it in this way but I don't like the way that I didit,is there a better
of doing that?

docLibName= pathFolder.Subs tring(pathFolde r.LastIndexOf("/") + 1);

subarea= tmpStr.Substrin g(tmpStr.LastIn dexOf("/") + 1);

portalName=
tmpStr.Remove(t mpStr.LastIndex Of("/"),(tmpStr.Subs tring(tmpStr.La stIndexOf("
/"))).Length );

thanks for your help
Nov 16 '05 #9
Sorry here is the complete code I used"

docLibName= pathFolder.Subs tring(pathFolde r.LastIndexOf("/") + 1);
string tmpStr= pathFolder.Remo ve(pathFolder.L ength -
docLibName.Leng th -1,docLibName.Le ngth + 1);

subarea= tmpStr.Substrin g(tmpStr.LastIn dexOf("/") + 1);

portalName=
tmpStr.Remove(t mpStr.LastIndex Of("/"),(tmpStr.Subs tring(tmpStr.La stIndexOf("
/"))).Length );

"ALI-R" <al*@microsoft. com> wrote in message
news:OW******** ******@TK2MSFTN GP09.phx.gbl...
Seems to be stimulating your sense of proud self-confidence on C#
capability in string manipulation,ok here we go,GET FIGHTED:
I have a string like string pathFolder=
"http://serverdev.hag.n et/Operation/Document Library"

I want to split it into these three segments:
1) "http://serverdev.hag.n et"
2)"Operation"
3)Document Library

I did it in this way but I don't like the way that I didit,is there a better of doing that?

docLibName= pathFolder.Subs tring(pathFolde r.LastIndexOf("/") + 1);

subarea= tmpStr.Substrin g(tmpStr.LastIn dexOf("/") + 1);

portalName=
tmpStr.Remove(t mpStr.LastIndex Of("/"),(tmpStr.Subs tring(tmpStr.La stIndexOf(" /"))).Length );

thanks for your help

Nov 16 '05 #10

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

Similar topics

7
2871
by: Ion | last post by:
Hi all, I have a query that takes almost 1 hour to complete. This is acceptable in certain situations, but unacceptable when no rows should qualify. Something like: Select list >From LargeTable (200 mil rows) Join ExpensiveTableFunction (based on LargeTable)
4
2230
by: JM | last post by:
Hi I have a Windows Form that I have 3 textboxes and some buttons. Below is the code that I have implemented it reads a pile of files from a folder and then reads each of the files. If the McAfee Dat file version is old (older than 15 revisions) then it will output the machine name, Scan Engine, and dat file version (all of this is each of the text files that I load) Is the way that I coded it poor C# OOP? I mean I have a registry...
10
399
by: Segfahlt | last post by:
I have a fairly simple C# program that just needs to open up a fixed width file, convert each record to tab delimited and append a field to the end of it. The input files are between 300M and 600M. I've tried every memory conservation trick I know in my conversion program, and a bunch I picked up from reading some of the MSDN C# blogs, but still my program ends up using hundreds and hundreds of megs of ram. It is also taking...
3
1151
by: John Smith | last post by:
Here's the scenario... First let me say that the following events were catastrophic to my development workstation because my C:\WINNT directory had the EVERYONE user group assigned with full control (inherited by all sub-directories). I believe this was set inadvertantly some time in the past while debugging a permissions issue. I know that this is very wrong, but it's not the problem I'm questioning. We have a ASP.Net page (VB...
11
3135
by: youngster94 | last post by:
Hey all, I've written a VB.Net app that creates picture badges complete with barcodes. The problem is that the barcode quality is not good enough to be read by scanners. I'm using the DRAWSTRING function to place the barcode on the image, but no matter what graphics settings (.InterpolationMode/.CompositingQuality etc.) I manipulate, the barcode image remains poor quality. For exaple I'm using a solidbrush that is black, but some of...
20
2106
by: John Mark Howell | last post by:
I had a customer call about some C# code they had put together that was handling some large arrays. The performance was rather poor. The C# code runs in about 22 seconds and the equivalent C++.Net code runs in 0.3 seconds. Can someone help me understand why the C# code performance is so poor? I rewote the C# code to use a single dimenional array and the time went down to about 3 seconds, but that's still no explaination as to why the...
11
2354
by: John Fly | last post by:
I'm working on a large project(from scratch). The program is essentially a data file processor, the overall view is this: A data file is read in, validated and stored in a memory structure similar to a database or XML representation. Rules to modify the stored data will be executed, then the data will be transformed into an output format. Think something similar to FormatA -> XML -> Manipulate XML -> FormatB
1
3888
by: Billy | last post by:
Hi All, I'm attempting to use the MapNetworkDrive <snippedbelow from entire code below with very poor performance results. Basically, I have very small 73kb text files that are rewritten daily to a network share using the MapNetworkDrive command to connect to the valid \\servername\share path. After successfully connecting the drive in the ASP code, the text file
6
6386
by: Bob | last post by:
Hi, I have a fairly large but not massive project. Visual Studio 2005 is starting to act very strange when I debug the project. For instance, if i set a break point, I often can't expand an array to see the contents. Instead, it will say "function evaluation timed out". Also, it takes a very long time to start and stop debugging, and sometimes it won't restart after I pause execution. I don't seem to have nearly as many problems in...
0
8457
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8883
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8788
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8646
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7390
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.