Find and Regex on value in _variant_tA simple way to convert to/from VARIANT types in C++Converting C++ class to JSONImage Processing: Algorithm Improvement for 'Coca-Cola Can' RecognitionC++ std::string compare with abbreviationsReplacing a 32-bit loop counter with 64-bit introduces crazy performance deviationsRegex - matching everything with number at the endcan I std::find a string in a stringstream?Search only beginning of string in c++ using regexfind multiple matches of overlapping substringsClip random integer to a range of values without using division/modulo
Should I join an office cleaning event for free?
Motorized valve interfering with button?
Is there a familial term for apples and pears?
How do we improve the relationship with a client software team that performs poorly and is becoming less collaborative?
Can I make popcorn with any corn?
What makes Graph invariants so useful/important?
Why does not dark matter gather and form celestial bodies?
When blogging recipes, how can I support both readers who want the narrative/journey and ones who want the printer-friendly recipe?
How do I create uniquely male characters?
Can a German sentence have two subjects?
How does one intimidate enemies without having the capacity for violence?
Infinite past with a beginning?
Simulate Bitwise Cyclic Tag
A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?
How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?
Shell script can be run only with sh command
Extreme, but not acceptable situation and I can't start the work tomorrow morning
A function which translates a sentence to title-case
Why Is Death Allowed In the Matrix?
"which" command doesn't work / path of Safari?
Could a US political party gain complete control over the government by removing checks & balances?
How can I fix this gap between bookcases I made?
Non-Jewish family in an Orthodox Jewish Wedding
What is the command to reset a PC without deleting any files
Find and Regex on value in _variant_t
A simple way to convert to/from VARIANT types in C++Converting C++ class to JSONImage Processing: Algorithm Improvement for 'Coca-Cola Can' RecognitionC++ std::string compare with abbreviationsReplacing a 32-bit loop counter with 64-bit introduces crazy performance deviationsRegex - matching everything with number at the endcan I std::find a string in a stringstream?Search only beginning of string in c++ using regexfind multiple matches of overlapping substringsClip random integer to a range of values without using division/modulo
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am working with OLE Variants created externally and accessing them through _variant_t
.
The Variants can contain text or numbers. I would like to be able to perform a search for arbitrary substrings in a similar fashion as std::string::find
. But I am hoping to not have to convert to string values first. I have searched for a similar method for _variant_t
but have not found one yet.
What is the best way to accomplish this?
In a similar vein, I'd like to also be able to perform Regex matching on the values stored in the Variants. How can this be done as well?
c++ visual-c++
add a comment |
I am working with OLE Variants created externally and accessing them through _variant_t
.
The Variants can contain text or numbers. I would like to be able to perform a search for arbitrary substrings in a similar fashion as std::string::find
. But I am hoping to not have to convert to string values first. I have searched for a similar method for _variant_t
but have not found one yet.
What is the best way to accomplish this?
In a similar vein, I'd like to also be able to perform Regex matching on the values stored in the Variants. How can this be done as well?
c++ visual-c++
What does it even mean, to regex search on a number?
– Passer By
Mar 22 at 6:25
I mean its string representation. If a Variant held the LONG value of 1230009, for example, the string representation of it would be, "1230009" and perhaps I'd like to see if that representation included, "000". However, the Variant is just as likely to contain text in the form of BSTRs. I am looking for two things: a method to do a normal find() and also a method to do more complicated Regex matching. I am hoping that_variant_t
has something like this already so that I don't have to reinvent the wheel.
– Excel Hero
Mar 22 at 6:45
It doesn't. You need to do it manually. You can use VariantChangeType or VariantChangeTypeEx to convert to a BSTR. Afterwords, you can assign the BSTR to a std::wstring and maybe use any Unicode regex funcs, or you can use WideCharToMultiByte() to convert to a std::string (not directly) and then use your regex functions.
– Joseph Willcoxson
Mar 22 at 16:29
@JosephWillcoxson Could you post an example as an answer?
– Excel Hero
Mar 22 at 23:16
add a comment |
I am working with OLE Variants created externally and accessing them through _variant_t
.
The Variants can contain text or numbers. I would like to be able to perform a search for arbitrary substrings in a similar fashion as std::string::find
. But I am hoping to not have to convert to string values first. I have searched for a similar method for _variant_t
but have not found one yet.
What is the best way to accomplish this?
In a similar vein, I'd like to also be able to perform Regex matching on the values stored in the Variants. How can this be done as well?
c++ visual-c++
I am working with OLE Variants created externally and accessing them through _variant_t
.
The Variants can contain text or numbers. I would like to be able to perform a search for arbitrary substrings in a similar fashion as std::string::find
. But I am hoping to not have to convert to string values first. I have searched for a similar method for _variant_t
but have not found one yet.
What is the best way to accomplish this?
In a similar vein, I'd like to also be able to perform Regex matching on the values stored in the Variants. How can this be done as well?
c++ visual-c++
c++ visual-c++
asked Mar 22 at 0:47
Excel HeroExcel Hero
10.6k21327
10.6k21327
What does it even mean, to regex search on a number?
– Passer By
Mar 22 at 6:25
I mean its string representation. If a Variant held the LONG value of 1230009, for example, the string representation of it would be, "1230009" and perhaps I'd like to see if that representation included, "000". However, the Variant is just as likely to contain text in the form of BSTRs. I am looking for two things: a method to do a normal find() and also a method to do more complicated Regex matching. I am hoping that_variant_t
has something like this already so that I don't have to reinvent the wheel.
– Excel Hero
Mar 22 at 6:45
It doesn't. You need to do it manually. You can use VariantChangeType or VariantChangeTypeEx to convert to a BSTR. Afterwords, you can assign the BSTR to a std::wstring and maybe use any Unicode regex funcs, or you can use WideCharToMultiByte() to convert to a std::string (not directly) and then use your regex functions.
– Joseph Willcoxson
Mar 22 at 16:29
@JosephWillcoxson Could you post an example as an answer?
– Excel Hero
Mar 22 at 23:16
add a comment |
What does it even mean, to regex search on a number?
– Passer By
Mar 22 at 6:25
I mean its string representation. If a Variant held the LONG value of 1230009, for example, the string representation of it would be, "1230009" and perhaps I'd like to see if that representation included, "000". However, the Variant is just as likely to contain text in the form of BSTRs. I am looking for two things: a method to do a normal find() and also a method to do more complicated Regex matching. I am hoping that_variant_t
has something like this already so that I don't have to reinvent the wheel.
– Excel Hero
Mar 22 at 6:45
It doesn't. You need to do it manually. You can use VariantChangeType or VariantChangeTypeEx to convert to a BSTR. Afterwords, you can assign the BSTR to a std::wstring and maybe use any Unicode regex funcs, or you can use WideCharToMultiByte() to convert to a std::string (not directly) and then use your regex functions.
– Joseph Willcoxson
Mar 22 at 16:29
@JosephWillcoxson Could you post an example as an answer?
– Excel Hero
Mar 22 at 23:16
What does it even mean, to regex search on a number?
– Passer By
Mar 22 at 6:25
What does it even mean, to regex search on a number?
– Passer By
Mar 22 at 6:25
I mean its string representation. If a Variant held the LONG value of 1230009, for example, the string representation of it would be, "1230009" and perhaps I'd like to see if that representation included, "000". However, the Variant is just as likely to contain text in the form of BSTRs. I am looking for two things: a method to do a normal find() and also a method to do more complicated Regex matching. I am hoping that
_variant_t
has something like this already so that I don't have to reinvent the wheel.– Excel Hero
Mar 22 at 6:45
I mean its string representation. If a Variant held the LONG value of 1230009, for example, the string representation of it would be, "1230009" and perhaps I'd like to see if that representation included, "000". However, the Variant is just as likely to contain text in the form of BSTRs. I am looking for two things: a method to do a normal find() and also a method to do more complicated Regex matching. I am hoping that
_variant_t
has something like this already so that I don't have to reinvent the wheel.– Excel Hero
Mar 22 at 6:45
It doesn't. You need to do it manually. You can use VariantChangeType or VariantChangeTypeEx to convert to a BSTR. Afterwords, you can assign the BSTR to a std::wstring and maybe use any Unicode regex funcs, or you can use WideCharToMultiByte() to convert to a std::string (not directly) and then use your regex functions.
– Joseph Willcoxson
Mar 22 at 16:29
It doesn't. You need to do it manually. You can use VariantChangeType or VariantChangeTypeEx to convert to a BSTR. Afterwords, you can assign the BSTR to a std::wstring and maybe use any Unicode regex funcs, or you can use WideCharToMultiByte() to convert to a std::string (not directly) and then use your regex functions.
– Joseph Willcoxson
Mar 22 at 16:29
@JosephWillcoxson Could you post an example as an answer?
– Excel Hero
Mar 22 at 23:16
@JosephWillcoxson Could you post an example as an answer?
– Excel Hero
Mar 22 at 23:16
add a comment |
0
active
oldest
votes
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%2f55291314%2ffind-and-regex-on-value-in-variant-t%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f55291314%2ffind-and-regex-on-value-in-variant-t%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 does it even mean, to regex search on a number?
– Passer By
Mar 22 at 6:25
I mean its string representation. If a Variant held the LONG value of 1230009, for example, the string representation of it would be, "1230009" and perhaps I'd like to see if that representation included, "000". However, the Variant is just as likely to contain text in the form of BSTRs. I am looking for two things: a method to do a normal find() and also a method to do more complicated Regex matching. I am hoping that
_variant_t
has something like this already so that I don't have to reinvent the wheel.– Excel Hero
Mar 22 at 6:45
It doesn't. You need to do it manually. You can use VariantChangeType or VariantChangeTypeEx to convert to a BSTR. Afterwords, you can assign the BSTR to a std::wstring and maybe use any Unicode regex funcs, or you can use WideCharToMultiByte() to convert to a std::string (not directly) and then use your regex functions.
– Joseph Willcoxson
Mar 22 at 16:29
@JosephWillcoxson Could you post an example as an answer?
– Excel Hero
Mar 22 at 23:16