Adding/Removing from String kdb2019 Community Moderator ElectionHTTP GET request to KDB+ Process using AngularJSHow to correctly enum and partition a kdb table?kdb how to remove string key from dictionaryqpython.sync() is returning a QProjection instead of the queried dataKDB split by fixed delimiterRemove part of string KDBApply var to the last n numbers of a column in a tableIdentify N maxes of a row, discarding the remaining bottom values from table rowsAddiing rows from from one dataset to another based on certain conditions when all columns name don't match in kdb+KDB: String comparison with a table
How to disable or uninstall iTunes under High Sierra without disabling SIP
Sometimes a banana is just a banana
Specific Chinese carabiner QA?
Make me a metasequence
Why is it "take a leak?"
How to fix my table, centering of columns
When to use mean vs median
What is the meaning of "notice to quit at once" and "Lotty points”
Plagiarism of code by other PhD student
How to get the first element while continue streaming?
How to merge row in the first column in LaTeX
Can a Trickery Domain cleric cast a spell through the Invoke Duplicity clone while inside a Forcecage?
Should I use HTTPS on a domain that will only be used for redirection?
Are all UTXOs locked by an address spent in a transaction?
Is every open circuit a capacitor?
Why would the IRS ask for birth certificates or even audit a small tax return?
Is divide-by-zero a security vulnerability?
Difference between 'stomach' and 'uterus'
Is there a frame of reference in which I was born before I was conceived?
is 'sed' thread safe
A peculiar integral identity
How to mitigate "bandwagon attacking" from players?
How does insurance birth control work?
Ahoy, Ye Traveler!
Adding/Removing from String kdb
2019 Community Moderator ElectionHTTP GET request to KDB+ Process using AngularJSHow to correctly enum and partition a kdb table?kdb how to remove string key from dictionaryqpython.sync() is returning a QProjection instead of the queried dataKDB split by fixed delimiterRemove part of string KDBApply var to the last n numbers of a column in a tableIdentify N maxes of a row, discarding the remaining bottom values from table rowsAddiing rows from from one dataset to another based on certain conditions when all columns name don't match in kdb+KDB: String comparison with a table
I was doing some work to do with kdb and have been tinkering with strings and variables. I was just wondering if its possible to remove part of a string and add something to do the end of it.
s1:"Hello" s2:" World"
I have a joint string "Hello World" which I created using
s3:s1,s2
I was trying to remove the Hello and add something after the World in the joint string.
s3[1*til 6] = Hello
This allows me to select the Hello part of the string if this helps
kdb
add a comment |
I was doing some work to do with kdb and have been tinkering with strings and variables. I was just wondering if its possible to remove part of a string and add something to do the end of it.
s1:"Hello" s2:" World"
I have a joint string "Hello World" which I created using
s3:s1,s2
I was trying to remove the Hello and add something after the World in the joint string.
s3[1*til 6] = Hello
This allows me to select the Hello part of the string if this helps
kdb
What solution did you try? You are already using comma to create s3 then you could use same for your other requirement. Instead of simply asking for answer, please also post your solution that you have tried.
– Rahul
15 hours ago
1
s3[1*til 6],"Of Warcraft" is what I had tried
– Aaron91204
15 hours ago
Cool. Try to mention your approach as well in your question that will help others to identify the root cause and to see where you are going wrong.
– Rahul
14 hours ago
add a comment |
I was doing some work to do with kdb and have been tinkering with strings and variables. I was just wondering if its possible to remove part of a string and add something to do the end of it.
s1:"Hello" s2:" World"
I have a joint string "Hello World" which I created using
s3:s1,s2
I was trying to remove the Hello and add something after the World in the joint string.
s3[1*til 6] = Hello
This allows me to select the Hello part of the string if this helps
kdb
I was doing some work to do with kdb and have been tinkering with strings and variables. I was just wondering if its possible to remove part of a string and add something to do the end of it.
s1:"Hello" s2:" World"
I have a joint string "Hello World" which I created using
s3:s1,s2
I was trying to remove the Hello and add something after the World in the joint string.
s3[1*til 6] = Hello
This allows me to select the Hello part of the string if this helps
kdb
kdb
edited 15 hours ago
Jonathon McMurray
1,875319
1,875319
asked 15 hours ago
Aaron91204Aaron91204
114
114
What solution did you try? You are already using comma to create s3 then you could use same for your other requirement. Instead of simply asking for answer, please also post your solution that you have tried.
– Rahul
15 hours ago
1
s3[1*til 6],"Of Warcraft" is what I had tried
– Aaron91204
15 hours ago
Cool. Try to mention your approach as well in your question that will help others to identify the root cause and to see where you are going wrong.
– Rahul
14 hours ago
add a comment |
What solution did you try? You are already using comma to create s3 then you could use same for your other requirement. Instead of simply asking for answer, please also post your solution that you have tried.
– Rahul
15 hours ago
1
s3[1*til 6],"Of Warcraft" is what I had tried
– Aaron91204
15 hours ago
Cool. Try to mention your approach as well in your question that will help others to identify the root cause and to see where you are going wrong.
– Rahul
14 hours ago
What solution did you try? You are already using comma to create s3 then you could use same for your other requirement. Instead of simply asking for answer, please also post your solution that you have tried.
– Rahul
15 hours ago
What solution did you try? You are already using comma to create s3 then you could use same for your other requirement. Instead of simply asking for answer, please also post your solution that you have tried.
– Rahul
15 hours ago
1
1
s3[1*til 6],"Of Warcraft" is what I had tried
– Aaron91204
15 hours ago
s3[1*til 6],"Of Warcraft" is what I had tried
– Aaron91204
15 hours ago
Cool. Try to mention your approach as well in your question that will help others to identify the root cause and to see where you are going wrong.
– Rahul
14 hours ago
Cool. Try to mention your approach as well in your question that will help others to identify the root cause and to see where you are going wrong.
– Rahul
14 hours ago
add a comment |
3 Answers
3
active
oldest
votes
you could use drop (_) to get rid of the "Hello" and join (,) to add on what you want. Something like
q)6_s3,"star Hiphop"
"Worldstar Hiphop"
If you didn't want to count the letters in the first word you could use vector from scalar (vs) to get a list of enlisted words and index into it, then join onto that:
q)(" " vs s3)[1],"star Hiphop"
"Worldstar Hiphop"
Hope this helps.
New contributor
add a comment |
Strings are character lists, so the drop function _
will still work on them. For example 1_"Hello"
will return ello
.
So if you want to remove "Hello" from your string s3
you would use
q)5_s3
"World"
Adding something onto the end of this then requires the join operator ,
, for example
q)s:"HelloWorld"
q)s1:"Mr. "
q)s2:5_s
q)s3:"wide"
q)s1,s2,s3
"Mr. Worldwide"
add a comment |
You could use the ssr function (string search replace).
q)s3:"HelloWorld"
q)ssr[s3;"Hello";""], " of War"
"World of War"
New contributor
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55021244%2fadding-removing-from-string-kdb%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
you could use drop (_) to get rid of the "Hello" and join (,) to add on what you want. Something like
q)6_s3,"star Hiphop"
"Worldstar Hiphop"
If you didn't want to count the letters in the first word you could use vector from scalar (vs) to get a list of enlisted words and index into it, then join onto that:
q)(" " vs s3)[1],"star Hiphop"
"Worldstar Hiphop"
Hope this helps.
New contributor
add a comment |
you could use drop (_) to get rid of the "Hello" and join (,) to add on what you want. Something like
q)6_s3,"star Hiphop"
"Worldstar Hiphop"
If you didn't want to count the letters in the first word you could use vector from scalar (vs) to get a list of enlisted words and index into it, then join onto that:
q)(" " vs s3)[1],"star Hiphop"
"Worldstar Hiphop"
Hope this helps.
New contributor
add a comment |
you could use drop (_) to get rid of the "Hello" and join (,) to add on what you want. Something like
q)6_s3,"star Hiphop"
"Worldstar Hiphop"
If you didn't want to count the letters in the first word you could use vector from scalar (vs) to get a list of enlisted words and index into it, then join onto that:
q)(" " vs s3)[1],"star Hiphop"
"Worldstar Hiphop"
Hope this helps.
New contributor
you could use drop (_) to get rid of the "Hello" and join (,) to add on what you want. Something like
q)6_s3,"star Hiphop"
"Worldstar Hiphop"
If you didn't want to count the letters in the first word you could use vector from scalar (vs) to get a list of enlisted words and index into it, then join onto that:
q)(" " vs s3)[1],"star Hiphop"
"Worldstar Hiphop"
Hope this helps.
New contributor
edited 15 hours ago
New contributor
answered 15 hours ago
SamSam
562
562
New contributor
New contributor
add a comment |
add a comment |
Strings are character lists, so the drop function _
will still work on them. For example 1_"Hello"
will return ello
.
So if you want to remove "Hello" from your string s3
you would use
q)5_s3
"World"
Adding something onto the end of this then requires the join operator ,
, for example
q)s:"HelloWorld"
q)s1:"Mr. "
q)s2:5_s
q)s3:"wide"
q)s1,s2,s3
"Mr. Worldwide"
add a comment |
Strings are character lists, so the drop function _
will still work on them. For example 1_"Hello"
will return ello
.
So if you want to remove "Hello" from your string s3
you would use
q)5_s3
"World"
Adding something onto the end of this then requires the join operator ,
, for example
q)s:"HelloWorld"
q)s1:"Mr. "
q)s2:5_s
q)s3:"wide"
q)s1,s2,s3
"Mr. Worldwide"
add a comment |
Strings are character lists, so the drop function _
will still work on them. For example 1_"Hello"
will return ello
.
So if you want to remove "Hello" from your string s3
you would use
q)5_s3
"World"
Adding something onto the end of this then requires the join operator ,
, for example
q)s:"HelloWorld"
q)s1:"Mr. "
q)s2:5_s
q)s3:"wide"
q)s1,s2,s3
"Mr. Worldwide"
Strings are character lists, so the drop function _
will still work on them. For example 1_"Hello"
will return ello
.
So if you want to remove "Hello" from your string s3
you would use
q)5_s3
"World"
Adding something onto the end of this then requires the join operator ,
, for example
q)s:"HelloWorld"
q)s1:"Mr. "
q)s2:5_s
q)s3:"wide"
q)s1,s2,s3
"Mr. Worldwide"
answered 15 hours ago
rmorganrmorgan
1014
1014
add a comment |
add a comment |
You could use the ssr function (string search replace).
q)s3:"HelloWorld"
q)ssr[s3;"Hello";""], " of War"
"World of War"
New contributor
add a comment |
You could use the ssr function (string search replace).
q)s3:"HelloWorld"
q)ssr[s3;"Hello";""], " of War"
"World of War"
New contributor
add a comment |
You could use the ssr function (string search replace).
q)s3:"HelloWorld"
q)ssr[s3;"Hello";""], " of War"
"World of War"
New contributor
You could use the ssr function (string search replace).
q)s3:"HelloWorld"
q)ssr[s3;"Hello";""], " of War"
"World of War"
New contributor
edited 13 hours ago
New contributor
answered 14 hours ago
Shannon O'NeillShannon O'Neill
312
312
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55021244%2fadding-removing-from-string-kdb%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What solution did you try? You are already using comma to create s3 then you could use same for your other requirement. Instead of simply asking for answer, please also post your solution that you have tried.
– Rahul
15 hours ago
1
s3[1*til 6],"Of Warcraft" is what I had tried
– Aaron91204
15 hours ago
Cool. Try to mention your approach as well in your question that will help others to identify the root cause and to see where you are going wrong.
– Rahul
14 hours ago