|
I had never used Join before, and after looking it up, it doesn't do the same thing as split, so my original response is crap. Join concatenates strings together, while split breaks a string up based on a delimiter character.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
No, it's just that it's more complicated to split on a string, i think, but easy to join on whatever.
I wrote some methods for doing it, if you want them i'll share them.
They're also intended for splitting on word breaks
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
maze3 wrote: Split only really wants a char, and Join only wants a string.
Usually splitting a string by just a char makes sense, however you should look at the method signature, it's actually not a char :
public String[] Split(params char[] separator);
(One of several array overloads)
Joining by a string makes tons of sense. For example, joining by CRLF.
Latest Article - Azure Function - Compute Pi Stress Test
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
maze3 wrote: var joined_str
maze3 wrote: var my_array
You don't mention why those two don't work well together, but could that overused three letter keyword be what obscures the actual problem?
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
BTW, I have a persistent string parser article I wrote in 2008. It might give to a starting point for rolling your own code. Keep in mind that I wrote this when I was just starting out in .Net, so refactoring it might be a good call.
Persistent String Parser[^]
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I am struggling to understand why you need to convert array to string, and then back to array?
|
|
|
|
|
To be sure, to be sure...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hahaha,
I should have pointed out me simply ranting.
10 second model/viewmodel with conversion of an old property.
"oh, but why not use auto models framework XX YY, that does this with an attribute tag MM!"
Life.
|
|
|
|
|
musefan wrote: I am struggling to understand why you need to convert array to string, and then back to array?
It's talking to a COBOL service.
Latest Article - Azure Function - Compute Pi Stress Test
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
maze3 wrote: Split only really wants a char, Not sure what you mean by "only really". It also accepts an array of char separators. But I wish it also had an overload that accepted a string that was interpreted as a set of char s. It's much easier to type.
/ravi
|
|
|
|
|
Am I missing something? There's an overload, albeit an ugly one:
string s = "Rob and Bob and Clob";
var z = s.Split(new[] {" and "}, StringSplitOptions.None);
Regards,
Rob Philpott.
|
|
|
|
|
vs_enterprise__1772378612.1554282312.exe --layout "A:\VS2019" == 24.7 GB
next to see if can install
Caveat Emptor.
"Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long
|
|
|
|
|
give it time. soon the install will be 2 TB and will cause your machine to physically explode,causing a rip in the space time continuum.
|
|
|
|
|
as soon as you install expect another several gigs of updates and downloads before you can actually use it
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
abmv wrote: "A:\VS2019"
Seriously? It ships on floppy drives? At 1.4MB per floppy, that like 24,000 floppies?
Latest Article - Azure Function - Compute Pi Stress Test
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
lol
Caveat Emptor.
"Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long
|
|
|
|
|
I'm guessing install time is about the same too.
|
|
|
|
|
Marc, we are old. People nowadays do not mentally associate A: with floppy anymore. Actually, there is no floppy drive anymore. Well, people even do not know anymore what was a floppy.
Installing MSWord - Insert disk 16/17
.
.
General failure reading drive A:
(A)bort, (R)etry, or (F)ail ?
*NOooooooo*
|
|
|
|
|
Working in the database today...
0) We import data from a remote source, and the data includes several datetime columns taht come over as varchars. This wouldn't be so bad, if after receiving that data, the programmer would have taken the time to convert it to the appropriate datetime datatype. But no.
0.5) We can't change the string date to a datetime, because we don't know exactly where the side effects will crop up, in the database, or in the app itself.
1) We directly modify the table that contains imported data, based on our business rules, and then move that table into the dbo scvhema for use by the application. The data pull is 4-5 hours long, and involves about 30 million records. After post-processing the imported data, if we find an error, we have to re-pull the data because we modified what we imported last time, because post-processing the already-post-processed data woiyuld be an invalid test of the post-processing code.
2) Importing and post-processing is handled by a 77-step sql job.
I talked the DBAs into adding as step to the job that copies the freshly imported data to a different schema so we could at least move it back to effect more timely testing, but FML.
While I was complaining loudly about the state of the data, one of the otrher devs suggested that I go ahead and "fix it", and I actually had to cite item 0.5 as a reason we can't.
This crap shoulda been fixed YEARS ago.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Couldnt you add a new string field?
datestring leave elephanting format untouched
datestring_standard unindexed aux data "should" not bother stuffy DBAs (in my dreams)
"If we don't change direction, we'll end up where we're going"
|
|
|
|
|
I'm not sure how that would fix the actual problem.
We propogate a date string into the database, and use it that way (other stored procs ar casting it to a datetime, and the app is expecting it as a string value, so we're right and truly f*cked). We can't change it because of the inevitable side effects it would cause. This is a massive system, and in point of fact, this is just one of the DOZENS of reasons I want to do a complete rewrite (app and data).
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Add a column to the DB? He'd need permission in triplicate from The Donald himself, plus an allocation from Congress of a few billion dollars ...
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Adding a column to the db could be done dynamically in the stored proc. This would mitigate the need to add instructions to our deployment script to change the table.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
#realJSOP wrote: This crap shoulda been fixed YEARS ago.
Ah, the mantra of the free soul that hasn't been crushed by the cogs of "I don't give a sh*t anymore."
Latest Article - Azure Function - Compute Pi Stress Test
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
#realJSOP wrote: This crap shoulda been fixed YEARS ago.
"Technical debt".
If there was ever a great example to use as a definition, this is it.
|
|
|
|