string-literals Questions

2

Solved

The CTRE library is able to parse and validate regular expressions at compile time using syntax like ctre::match<"REGEX">(text_to_search). I know this syntax is only supported...
Ecclesiolatry asked 17/6, 2021 at 18:12

6

Solved

What is the difference between backticks (``) & double quotes ("") in golang?
Ramiform asked 24/10, 2017 at 18:12

10

Every one of us has (probably) had the childhood dream of writing: switch(my_std_string) { case "foo": do_stuff(); break; case "bar": do_other_stuff(); break; default: just_give...
Galasyn asked 26/12, 2016 at 23:25

3

Solved

I was reading a Postgres/PostGIS statement like this: SELECT ST_AsBinary( ST_GeomFromWKB( E'\\001\\001\\000\\000\\000\\321\\256B\\312O\\304Q\\300\\347\\030\\220\\275\\336%E@', 4326 ) ); The a...
Antwanantwerp asked 16/1, 2016 at 3:17

2

Solved

Is there a way to add a literal field at the end of a Google Sheets QUERY function similar to what you can do in SQL? e.g. =QUERY(A:C,"SELECT A, B, C, D AS 'CURRENT DATA'",0) Thanks, Stefan
Dijon asked 4/8, 2016 at 14:45

4

In Typescript, suppose I want to call a function with following signature- function foo(param: "TRUE"|"FALSE"|"NONE") How can I do something like- var str = runtimeString() if(str === "TRUE" | ...
Sawn asked 22/7, 2016 at 11:10

5

Solved

On a microcontroller, in order to avoid loading settings from a previous firmware build, I also store the compilation time, which is checked at loading. The microcontroller project is build with 'm...
Acanthopterygian asked 15/1 at 12:45

7

Solved

In the quest for localization I need to find all the string literals littered amongst our source code. I was looking for a way to script this into a post-modification source repository check. (I.E....
Hexamerous asked 2/10, 2008 at 20:23

3

Solved

I'm confused about the type of a string literal. Is it a const char * or a const char?
Tympanist asked 20/9, 2012 at 17:45

2

Solved

I've been wondering, how long does a string constant live in C++. For example, if I create some const char *str = "something" inside a function, would it be safe to return the value of str? I wrot...
Angellaangelle asked 15/7, 2014 at 13:49

5

Solved

Consider this code: const char* someFun() { // ... some stuff return "Some text!!" } int main() { { // Block: A const char* retStr = someFun(); // use retStr } } In the function someFun()...
Grubb asked 5/4, 2010 at 17:32

20

Solved

I have the above-mentioned error in s1="some very long string............" Does anyone know what I am doing wrong?
Masseter asked 24/8, 2010 at 23:4

7

Solved

Is it possible to create a constructor (or function signature, for that matter) that only accepts a string literal, but not an e.g. char const *? Is it possible to have two overloads that can dist...
Rumelia asked 11/1, 2010 at 11:3

5

Solved

I wanted to compare a string to a string literal; something like this: if (string == "add") Do I have to declare "add" as a string or is it possible to compare in a similar way...
Countercurrent asked 3/6, 2011 at 3:10

3

Solved

There is a very convenient feature introduced in C++11 called raw string literals, which are strings with no escape characters. And instead of writing this: regex mask("\\t[0-9]+\\.[0-9]+\\t\\\\S...
Outfielder asked 29/9, 2013 at 8:34

2

Solved

disp(['counter ' num2str(blk) (here I need a tab!!!) 'adc ' num2str(adc_nr)])
Watthour asked 8/3, 2011 at 12:6

1

Solved

I read that string literals are always stored in read only memory and it makes sense as to why. However if I initialize a character array using a string literal, it still stores the string literal ...
Tenorrhaphy asked 12/6, 2023 at 12:1

3

Solved

I think i quite understand how to use the keyword constexpr for simple variable types, but i'm confused when it comes to pointers to values. I would like to declare a constexpr C string literal, w...
Nikolenikoletta asked 7/9, 2017 at 15:36

5

C++03 5.1 Primary expressions §2 says: A literal is a primary expression. Its type depends on its form (2.13). A string literal is an lvalue; all other literals are rvalues. Similarly, C99 6.5...
Doti asked 4/4, 2012 at 3:23

5

Solved

I am trying to figure out how to write a macro that will pass both a string literal representation of a variable name along with the variable itself into a function. For example given the followin...
Disastrous asked 8/5, 2012 at 22:7

15

Solved

When should I use single quotes and double quotes in C or C++ programming?
Unrefined asked 10/9, 2010 at 9:43

2

I'm wondering if it's possible in C++ to declare a function parameter that must be a string literal? My goal is to receive an object that I can keep only the pointer to and know it won't be free()e...
Infinitive asked 9/9, 2021 at 20:20

8

Solved

I have a table test(id,name). I need to insert values like: user's log, 'my user', customer's. insert into test values (1,'user's log'); insert into test values (2,''my users''); insert into t...
Caressa asked 7/9, 2012 at 11:11

5

I was reading the MSDN article of the boolean structure, when I saw that a boolean has two fields: TrueString and FalseString. These respectively return "True" and "False". After some searching, t...
Sapp asked 3/7, 2013 at 12:3

4

Solved

What is the meaning and difference between these queries? SELECT U'String' FROM dual; and SELECT N'String' FROM dual;
Gavrah asked 3/1, 2018 at 11:25

© 2022 - 2024 — McMap. All rights reserved.