Questions tagged [string]

A sequence of characters.

Filter by
Sorted by
Tagged with
2 votes
6 answers
16k views

How to change a CSV layer attribute value from text to number - once again? [closed]

i have read most of the related postings and answers allready ... (e.g. http://anitagraser.com/2011/03/07/how-to-specify-data-types-of-csv-columns-for-use-in-qgis/ and Changing CSV layer attribute ...
robert tuw's user avatar
0 votes
3 answers
6k views

Extracting numbers from string field using Python Parser of ArcMap Field Calculator?

I am trying to calculate field test2 with only the numeric values from a string field test. The entire script is like: def makestr(test) list=[] for s in test: if s.isdigit(): ...
Stelios Tselepis's user avatar
24 votes
5 answers
47k views

Using replace string function in QGIS Field Calculator

Within an attribute table, I'm trying to replace one string with another using the replace function. As an example, there are a number of features whose field "NAME" contains the string '(B)...
GrahamD's user avatar
  • 241
13 votes
3 answers
18k views

Extracting part of string from field in QGIS Field Calculator?

I want to create a new field in my attribute table. My goal: returning all digits between the / and _ characters of the field named "location" by applying the next expression: regexp_substr( ...
abrobia's user avatar
  • 137
9 votes
4 answers
16k views

Extracting text before first slash "/" in QGIS

I have a database of motorway junctions which are named like this: M90 J8/A91/B996 M90 J1/A90/A921/A985(T) M9 J1A There is significant variability in the length of the strings but they all follow ...
Ed Rollason's user avatar
  • 3,888
9 votes
2 answers
5k views

Is there an escape option for single quotes & apostrophes in QGIS?

I'm trying to use the Data Defined symbology in QGIS ver 2.2. Some of my data has single quotes/apostrophes. Since the string must use single quotes, is there an escape option I can use for the field ...
mike's user avatar
  • 981
7 votes
2 answers
4k views

Extracting only number from address in QGIS Attribute Table

I want to print only the number part of the address field. I tried to use the "field calculator" with "regexp_substr" to extract just the number (only string before the first space) but couldn't ...
Horia Popa's user avatar
6 votes
2 answers
3k views

Splitting string (the last digits) in QGIS

I´m working with QGIS 2.12. Is it possible to split string "from the right side" (it means I needed the last text from every field)? In one field I have description like: description new ...
lucy147's user avatar
  • 71
5 votes
1 answer
2k views

Sending arguments to LAStools function from Python script not working

I`m trying to call the lasground module from a python script, using this method: args=['lasground', '-i *.las', output_file, arg_step, arg_spike, arg_spikedown, arg_offset, arg_bulge, arg_cores] proc=...
Mihnea's user avatar
  • 131
4 votes
1 answer
417 views

Summing numbers separated by commas in string field in QGIS

In QGIS, I have a column separated by comma (shown by column "lengths"). I want to sum up elements in it for each row. The column is a text field string.
Eren E's user avatar
  • 143
2 votes
1 answer
2k views

Creating multiple lines label in QGIS?

I try to create a multiple lines label for this this polygon: I red How to create multiline labels in QGIS? QGIS, Multiple lines and wrap on character? and tried to use the "wordwrap" function ...
newGIS's user avatar
  • 4,062
11 votes
2 answers
4k views

Obtaining specific part of string from field in QGIS attribute table?

I'm having a bit of trouble here with this situation. I want "NumeroCamp" only to have the numbers are showing in "Text". Is there any function in field calculator that could help me with that?
Alexandre Rodrigues's user avatar
8 votes
3 answers
5k views

Converting numeric fields into strings with leading zeros

I'm trying to define an action in QGIS using on of my fields but I have some problems with its format. I have a numeric string like '5' and I need to have a format like '005'. I've tried function ...
Pau.ReRi's user avatar
  • 115
7 votes
4 answers
2k views

Inserting additional text into string field with the Field Calculator in QGIS

In QGIS 3.18.3, I have a GeoPackage attribute table containing a string field that I will call "FIELD_1". All records within "FIELD_1" take the form of a_a_a_a_a, where a = ...
Stu Smith's user avatar
  • 8,302
7 votes
2 answers
6k views

How to extract part of string after '*', '~', '-' or '#'

I have strings like this: 234/1-1 3345#5 11/2~10 6754*15 It needed only rightmost part of string after '-', '#', '~'or '*' . I figured how to extract when there is only one sign for example '~' ...
draganche85's user avatar
6 votes
2 answers
3k views

How to delete last part of a string starting from the 1st non numeric character? [closed]

I'm looking for a Python or VB statement to remove the last part of a string, starting where the 1st non Numeric character appears, using the Field Calculator in ArcMap 10. Here's an example of what I'...
astro.comma's user avatar
5 votes
1 answer
905 views

How to use label maximum line length for word wrapping in QGIS 3

I am confused on how to use the maximum line length for word wrapping a label in QGIS 3. The dialog and documentation show an option to "Wrap lines to" and then allow selecting "Maximum ...
bdelliott's user avatar
  • 455
5 votes
2 answers
322 views

QGIS automatic fill of the attribute table by expression

I have a line layer and in the attribute list the "Name" column, which can be, for example, 'V1','V2',....'V1-2','V1-2-3',... in I'm trying to put an expression in the next column that is ...
sttipa's user avatar
  • 95
4 votes
0 answers
158 views

Using an input string in a file path for a input vector layer in QGIS model

I am building a QGIS model to perform field calculations on a large number of .shp files containing environmental information of different waterbodies. This model should be global for the different ...
Leesbiology's user avatar
3 votes
5 answers
822 views

Extracting digits from string in QGIS

I have a string field that I want to extract only the digits example: 1,500 m2 -> 1500 I've tried with regexp_substr("location", '(\\d*)') to remove all after the blank space, but I need ...
Juan Millan's user avatar
3 votes
3 answers
2k views

Sorting string column Qgis

I would like to order my field like "normal" but as this column is string it won't work. I got "Emplacement réservé 105";"Emplacement réservé 106"; .... before "Emplacement réservé 20". What should ...
Arthur's user avatar
  • 893
3 votes
1 answer
2k views

Removing zeros in string at different places with QGIS Field Calculator

I'd like to take the values from the "MAP_PAR_ID" attribute and populate a new field without zeros (including leading zeros) in that field, e.g.: MAP_PAR_ID New_Field 0160011000 16-11 ...
geomajor56's user avatar
  • 2,102
2 votes
1 answer
290 views

Returning strings showing all vertices from all polygons in shapefile using ArcPy?

I want to have a string showing all vertices from all polygons in a shapefile. In my example below my code lists all vertices and the first column shows the polygon they are part of (I only have 2 in ...
Giacomo's user avatar
  • 307
2 votes
3 answers
8k views

Selecting files with same first 5 characters in filename for merging?

I have a number of polygon feature classes in a geodatabase dataset. The file names are as below: e.g. IHO1a_xxx-xxxx_ALB,IHO1b_xxx-xxxx_MBES_10m, IHO1b_xxx-xxxx_MBES_2m I would like to get a python ...
PCad's user avatar
  • 53
2 votes
2 answers
4k views

Can I use the LEFT (string) operator in ExecuteSQL()?

In QGIS I can use the LEFT operator on a dataset like this: LEFT( "Name2",3) ='031' What is the syntax for using this expression with ogr in python? Isn't this the right syntax? a=water....
LarsVegas's user avatar
  • 2,536
2 votes
1 answer
460 views

QGIS 3 batch processing - INPUT value not correct when autofill

I want to batch process with Clip function (also problem with any other). I have several input layers. I would like to autofill the output Clipped parameter with name of the input feature and _clipped ...
janchytry's user avatar
  • 187
0 votes
1 answer
270 views

How do you add user variables to custom Python functions in QGIS Function Editor?

How do you add user input variables to a Custom Function created in Python in QGIS3.x. I found the below piece of code but need to modify it to control the string to split by and the index value to ...
MrKingsley's user avatar
  • 1,433
0 votes
2 answers
12k views

Changing string to integer using ArcGIS Field Calculator?

I have a table with two fields. One field (type short) is empty. One field (type string) is full of digits. There are no random characters in that field, just digits. I want to convert the string ...
Bob Dole's user avatar
  • 129