Motherf'in, b'strd, c@ntin Stringbuilders!
-
RANT! Why do they not have a "Find" function? They have "Remove". They have "Replace". Why no "Find"? In order to be efficient, I am building a webpage from a hierarchical tree of classes, into a StringBuilder. To save space, I have a "readable" mode, where all tags are indented properly, and an "Efficient" mode which doesn't indent, and shouldn't include trailing close tags - much the way Google doesn't. So, I've built it, I've checked it, I'm happy to do the last bit: remove trailing close tags. But I can't do it in the StringBuilder. I could remove the text from the damn thing, if I knew where it started. But, I have to convert it to a string and search that - which was exactly what I was trying to avoid when I used a StringBuilder in the first place. It's not a major hassle - a quick regex and I'm there - but why do I have to convert it to a string, then run a regex on it to create another string, when all I want to do is find out where to start ripping the data out of the bloody StringBuilder in the first place! :mad: Oooh. I feel better now. Sorry to have dumped that here, but I needed a rant and the lounge is not the place for this!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
-
RANT! Why do they not have a "Find" function? They have "Remove". They have "Replace". Why no "Find"? In order to be efficient, I am building a webpage from a hierarchical tree of classes, into a StringBuilder. To save space, I have a "readable" mode, where all tags are indented properly, and an "Efficient" mode which doesn't indent, and shouldn't include trailing close tags - much the way Google doesn't. So, I've built it, I've checked it, I'm happy to do the last bit: remove trailing close tags. But I can't do it in the StringBuilder. I could remove the text from the damn thing, if I knew where it started. But, I have to convert it to a string and search that - which was exactly what I was trying to avoid when I used a StringBuilder in the first place. It's not a major hassle - a quick regex and I'm there - but why do I have to convert it to a string, then run a regex on it to create another string, when all I want to do is find out where to start ripping the data out of the bloody StringBuilder in the first place! :mad: Oooh. I feel better now. Sorry to have dumped that here, but I needed a rant and the lounge is not the place for this!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
Doesn't "Replace" take an empty or null parameter? :doh:
Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
-
Doesn't "Replace" take an empty or null parameter? :doh:
Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
Yep - but it doesn't help if you want to match all the empty HTML closing tags, but leave the rest untouched!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
-
RANT! Why do they not have a "Find" function? They have "Remove". They have "Replace". Why no "Find"? In order to be efficient, I am building a webpage from a hierarchical tree of classes, into a StringBuilder. To save space, I have a "readable" mode, where all tags are indented properly, and an "Efficient" mode which doesn't indent, and shouldn't include trailing close tags - much the way Google doesn't. So, I've built it, I've checked it, I'm happy to do the last bit: remove trailing close tags. But I can't do it in the StringBuilder. I could remove the text from the damn thing, if I knew where it started. But, I have to convert it to a string and search that - which was exactly what I was trying to avoid when I used a StringBuilder in the first place. It's not a major hassle - a quick regex and I'm there - but why do I have to convert it to a string, then run a regex on it to create another string, when all I want to do is find out where to start ripping the data out of the bloody StringBuilder in the first place! :mad: Oooh. I feel better now. Sorry to have dumped that here, but I needed a rant and the lounge is not the place for this!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
-
I admit it is weird, but what is stopping you from doing this? (C#)
StringBuilderInstance.ToString().IndexOf(...)
V.
It creates a new, immutable string, which I can only use for searching. I can't chop the bits I don't need of the end of that, because that just creates another, also immutable, string - exactly why I use StringBuilder in the first place! It's not a problem - there are ways round it, but if IndexOf and IndexOfLast had been implemented, there would be no need to waste time and memory constructing useless interim objects. It just offends my sense of symmetry, I guess. (As you may have guessed, I have calmed down a lot since yesterday)
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
-
RANT! Why do they not have a "Find" function? They have "Remove". They have "Replace". Why no "Find"? In order to be efficient, I am building a webpage from a hierarchical tree of classes, into a StringBuilder. To save space, I have a "readable" mode, where all tags are indented properly, and an "Efficient" mode which doesn't indent, and shouldn't include trailing close tags - much the way Google doesn't. So, I've built it, I've checked it, I'm happy to do the last bit: remove trailing close tags. But I can't do it in the StringBuilder. I could remove the text from the damn thing, if I knew where it started. But, I have to convert it to a string and search that - which was exactly what I was trying to avoid when I used a StringBuilder in the first place. It's not a major hassle - a quick regex and I'm there - but why do I have to convert it to a string, then run a regex on it to create another string, when all I want to do is find out where to start ripping the data out of the bloody StringBuilder in the first place! :mad: Oooh. I feel better now. Sorry to have dumped that here, but I needed a rant and the lounge is not the place for this!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
What's stopping you from implementing the IndexOf function yourself?
-
What's stopping you from implementing the IndexOf function yourself?
It's a sealed class and I can't get at the internals except character by character! I could do it, but why the heck didn't MS? Isn't it fairly obvious that if you provide Insert and Remove that work on indexes that it would be kinda useful to be able to find out where to Insert and Remove? :laugh:
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
-
It's a sealed class and I can't get at the internals except character by character! I could do it, but why the heck didn't MS? Isn't it fairly obvious that if you provide Insert and Remove that work on indexes that it would be kinda useful to be able to find out where to Insert and Remove? :laugh:
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
How else would you search for a string except character by character?
-
How else would you search for a string except character by character?
:laugh: You know what I mean!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
-
RANT! Why do they not have a "Find" function? They have "Remove". They have "Replace". Why no "Find"? In order to be efficient, I am building a webpage from a hierarchical tree of classes, into a StringBuilder. To save space, I have a "readable" mode, where all tags are indented properly, and an "Efficient" mode which doesn't indent, and shouldn't include trailing close tags - much the way Google doesn't. So, I've built it, I've checked it, I'm happy to do the last bit: remove trailing close tags. But I can't do it in the StringBuilder. I could remove the text from the damn thing, if I knew where it started. But, I have to convert it to a string and search that - which was exactly what I was trying to avoid when I used a StringBuilder in the first place. It's not a major hassle - a quick regex and I'm there - but why do I have to convert it to a string, then run a regex on it to create another string, when all I want to do is find out where to start ripping the data out of the bloody StringBuilder in the first place! :mad: Oooh. I feel better now. Sorry to have dumped that here, but I needed a rant and the lounge is not the place for this!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."
Probably because the java class they copied the interface off of didn't have it. Also, as much as it is a pain in the ass, the stream apis, or iterating through the data yourself and writing directly to the output stream yourself is probably a better solution anyway.
Curvature of the Mind now with 3D