This is probably quite a simple question, but I can't remember how to do it off hand.
I have an e-mail address of "foo#bar.com".
I want to grab the # and everything after it and then I'll be adding a prefix to the front of the address as I go.
I'm just wonderng how I get hold of the #bar.com from the string?
I know I should know how to do this as this is a really simple operation.
Thanks in advance for any help.
"foo#bar.com".Split("#")(1)
You can use simple string operations for this:
email.Substring(email.IndexOf("#"C))
Related
I would like to have possibility in Karate to match all paths except /example/path, to have something like this:
pathMatches ('!/example/path')
Is there such possibility?
You can use the requestUri variable which will be always set automatically. The nice thing about the design is you can use "normal" Java Script and achieve any combination you want, pathMatches() is just pre-defined for convenience.
So this should get you what you want, try it !
Scenario: !requestUri.startsWith('/example/path')
EDIT: silly me, I just realized that you have a much better option, again "because JavaScript". This will work !
Scenario: !pathMatches('/example/path')
I have seen a lot of questions about this but I couldn't find the correct answer for me which works.
The object which triggers the problem is like
test123.de.company.com.Database.dbo.Table
Test123.de.company.com
is the database Server.
Object name contains more than the maximum prefixes allowed
I have tried to write it like this [test123.de.company.com].Database.dbo.Table just like [test123.de.company.com].[Database].[dbo].[Table]
Can you tell me what's wrong with this?
Please try this:
["test123.de.company.com"].[Database].[dbo].[Table]
OP also encountered a new problem after implementing this solution above. OP said:
Thank you! This worked for me. To be more precise, the join is for a
view and if I save/close and then later get back to the design option
the quote marks are removed and there is [test123.de.company.com] left
over and the error returns. Is there a way to keep them fixed?
Otherwise if I change anything I always have to add the quote marks
again and again
Then with the help of DaleK that problem also was solved. DaleK:
Don't use the design option, script it as alter instead
I am trying to place a variable in the parameter of a #uses path, like so...
{#uses parameter="/p/a/t/h/{variable}/e/t/c"}
...
{/uses}
Here is a more pragmatic example...
{#uses parameter="/api/{user}/profile"}
...
{/uses}
Needless to say, its not working. So, what is the correct way to approach this?
Thanks in advance for the help!
Using T-SQL, I'm trying to find the easiest way to make:
"abc.def.ghi/jkl" become "abc/def/ghi.jkl"?
Basically switch the . and /
Thank you
One way
select replace(replace(replace('abc.def.ghi/jkl','/','-'),'.','/'),'-','.')
you need to use an intermediate step, I chose the - symbol, choose something which won't exist in your string
SELECT REVERSE(#myvar) AS Reversed,
RIGHT(#myVar, CHARINDEX(‘ ‘, REVERSE(#myvar))) as Lastname;
took the answer from this guys blog. The first google result. You will need to modify it for your needs
link text
I am a perfectionist and need a good name for a function that parses data that has this type of format:
userID:12,year:2010,active:1
Maybe perhaps
parse_meta_data()
I'm not sure what the correct name for this type of data format is. Please advise! Thanks for your time.
parse_dict or parse_map
Except for the lack of braces and the quotes around the keys, it looks like either JSON or a Python dict.
parse_tagged_csv()
parse_csv()
parse_structured_csv()
parse_csv_with_attributes()
parse csvattr()
If it’s a proprietary data format, you can name it whatever you want. But it would be good to use a common term like serialized data or mapping list.
If it's just a list of simple items, each of which has a name and a value, then "key-value pairs" is probably the right term.
I would go with:
parse_named_records()
ParseCommaSeparatedNameValuePairs()
ParseDelimitedNameValuePairs()
ParseCommaSeparatedKeyValuePairs()
ParseDelimitedKeyValuePairs()
From the one line you gave, ParseJson() seems appropriate