FAQ Database Discussion Community


trim base64 string by ltrim() missing character in PHP

php,base64,trim
here is a base64 code begin with: data:image/png;base64. I use ltrim() like this: $base64_data='data:image/png;base64,iVboR....'; $base64_data = ltrim($base64_data,'data:image/png;base64,'); but the result is wrong whitout character "i". is "VboR...." why?...

Find svg viewbox that trim whitespace around

svg,space,trim,viewbox
Assuming I have an svg that draws some paths, what tools should I use to find a viewbox that perfectly fits those paths so that all redundant space around is trimmed?

Trim field value, or remove part of the value

logstash,trim,grok,logstash-grok
I am trying to adjust path name so that it no longer has the time stamp attached to the end. I am input many different logs so it would be impractical to write a conditional filter for every possible log. If possible I would just like to trim the last...

How to extract postcode/digits from one column and put it in to another column in SQL Oracle 9i

sql,regex,substring,trim,oracle9i
Table ADRESSES contains columns [ ID, STREET, TOWN, POSTCODE,COUNTRY ]. Hot to make statement in Oracle 9i database: if column COUNTRY contains string 'UK', and POSTCODE is empty but column TOWN starts with post code (digits in format xxxxx or xx-xxx), then move postal code to column POSTCODE and strip...

Trim Spaces inside whole Database

sql,database,sql-server-2012,trim
How to trim spaces inside all table's column values from particular Database? It has to LTrim & RTrim spaces inside row column values from all tables in Database. How Can I do that? ...

How to trim all leading/trailing
code using php

php,html,trim
I am trying to remove all leading and trailing <br> in a string using PHP. Here is an example <br><br> Hello<br> World<br> <p>This is a message<br>...</p> <br><br><br><br> I want to return Hello<br> World<br> <p>This is a message<br>...</p> I tried to do the following echo trim($str, '<br>'); But it does not...

trim string to a specific character

android,string,trim
I want to trim a specific String till a specific character. So the String: com.icecoldapps.screenshoteasy for example shall be the String screenshoteasy. But larger Strings like com.google.android.syncadapters.contacts shall also be trimed to contacts. How to do that? Thanks...

Remove empty spaces inside

tags using BeautifulSoup

python,html,beautifulsoup,trim
There are some paragraphs in my string html that look like this: <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </p> I want to remove empty spaces inside p tags and turn it into: <p>Lorem ipsum dolor sit...

Javascript trim multiline string without cutting words

javascript,regex,string,trim,cut
I'm looking for an answer to trim a string to a certain length of chars without cutting words. I searched the questions and found this: javascript shorten string without cutting words I wanted to use @Hamish s answer with the regex replacement but encountered problems with multiline texts. @Hamish s...

sql find and remove duplicate columns with trim

mysql,sql,duplicates,trim
I have a table "partner_entries" with 3 columns : our_ref | partner_ref | partner_tag where all thoses 3 fields form the primary key. I have a certain amount of "duplicate" rows like this : 42 | abc | tag1 42 | abc | tag1 As you can see it's not...

How to remove last numbers of string with different lengths C#

c#,string,trim
NOTE: The lengths of the last 2 is different. So Length-1 doesn't work(right?) How do I remove the last numbers from example: ABStreet 10 552896 ACLane 1520 155 So that it outputs: ABStreet 10 ACLane 1520 It probbably is already asked somewhere, and I though of TrimEnd, but I can't...

Python PIL - AttributeError: 'NoneType' object has no attribute 'save'

python,border,python-imaging-library,crop,trim
I use this code to delete the border of an image using PIL: def RemoveBlackBorders(img): bg = Image.new(img.mode, img.size, img.getpixel((0,0))) diff = ImageChops.difference(img, bg) diff = ImageChops.add(diff, diff, 2.0, -100) bbox = diff.getbbox() if bbox: return img.crop(bbox) from here And I use this to process all images contained in a...

Extra white spaces automatically disabled in PhP: why?

php,html,google-chrome,safari,trim
I was trying to use the trim() function on my $_POST variable for a form I just created, but noticed there was no use as the extra white spaces are automatically disabled. I created a very simple PhP form (form.php) asking a name to the user. Then I have in...

TrimEnd Equivalent in SQL Server

sql,sql-server-2008,trim
I have column (Numbers) which has values as follows: 1,2,3 1,2,3, 1,2,3,,, 1,2,3,,,,,, I want to Trim all the Commas at the end of string, So that result would be 1,2,3 1,2,3 1,2,3 1,2,3 I have tried below Query but by this we can remove only one last comma DECLARE...

Mysql Select Distinct w TRIM() and Subselect Optimize Performance

mysql,performance,subquery,distinct,trim
I have a table mailing_list with the columns id, optout, email The email has duplicates, but the optout isn't the same even if the email is the same. So we can have data like this... id optout email 1 0 [email protected] 2 1 [email protected] 3 0 [email protected] 4 0 [email protected]

TrimEnd and strange(?) result [duplicate]

vb.net,trim
This question already has an answer here: strange TrimEnd behaviour with \ char 2 answers I did this simple test: Dim arg1 As String = "TestString1" Dim arg2 As String = "String1" Dim result As String = arg1.TrimEnd(arg2.ToCharArray()) Now, results contain "Tes" instead of the expected "Test". Why?...

Removing Digits from a Number

swift,numbers,trim,trimming
Does anybody know if there is a way of removing (trimming) the last two digits or first two digits from a number. I have the number 4131 and I want to separate that into 41 and 31, but after searching the internet, I've only managed to find how to remove...

Java like trim function for perl

perl,trim
Is there an Java like trim function for Perl. I am looking for function in Perl that removes all the leading and trailing characters below 0x20, like in Java. After calling the function on the following string. my $string = "\N{U+0020}\N{U+001f}\N{U+001e}\N{U+001d}\N{U+001c}\N{U+001b}\N{U+001a}\N{U+0019}\N{U+0018}\N{U+0017}\N{U+0016}\N{U+0015}\N{U+0014}\N{U+0013}\N{U+0012}\N{U+0011}Hello...

Trimming Blank Spaces in Char Column in DB2

casting,db2,trim
I'm trying to remove blank spaces that appear in a CHAR column within DB2. I received some helped here with the function TRANSLATE to determine if Left contained records that began with three letters: select pat.f1, hos.hpid, hos.hpcd from patall3 pat join hospidl1 hos on pat.f1=hos.hpacct where TRANSLATE( LEFT( hos.hpid,...

How can I delete spaces on php [closed]

php,forms,delete,trim
PHP delete spaces if $adsoyad comes like "hello____", where _ are spaces. I need to delete all spaces and save the string as "hello". I used trim(), but I couldn't do it....

Why trim in postgres 9.3 did not do the work?

sql,postgresql,trim
We want to trim the leading and trainling space for resource column in postgres 9.3 and it seems to be a simple job. Here is the SQL: update tablename set resource=trim(resource); The query is executed in postgres admin tool SQL screen successfully. However the space was not trimmed. Then we...

Trim strings before using map?

javascript,jquery,arrays,trim
I want to get all input values from a page a user has made and want to store it in an array to make an ajax-call to process the data. I'm doing it this way: $('#save').click(function(){ var data = $('*[data-array]').map(function(idx, elem) { $.trim(elem); return $(elem).val(); }).get(); The problem is that...

Fastest way to remove 'extra' spaces (more than 1) from a large range of cells using VBA for excel

excel-vba,replace,trim,spaces
I've been looking around and haven't found a great answer to the question on how to remove extra spaces from a large range of cells containing text strings. Let's say 5000+ cells. some ways I have tried include: For Each c In range c.Value = Trim(c.Value) Next c and For...

VBA, excel cut a part from a string

excel,vba,excel-vba,trim
I would like to get a part from a string. Im not familiar with VBA or unusual excel functions, but I think maybe a macro or a VBA code can help me. I need to cut down everything from the whole string from the cell, except what is after the...

Split string data on a string match

xml,swift,trim,truncate
I'm working with some xml and I'd like to clean it up before I parse it. What i'd like to do specifically, is take the data (example below) and match it on the string "<data>" and then trim everything before it leaving the node in tact. Then I would match...

Trim PHP String with variable within it

php,string,trim
I seek your assistance once more with a small problem I am having, the solution is potentially obvious/looking at me in the face, but I have yet to resolve my issue. I have the need to trim a string which happens to have a variable within it. (the string is...

Trim leading zeros in comma separated values in a column

mysql,sql,regex,replace,trim
Ex.Table Store store_id Employee_id 0020,0345,0002345 0234 0034 0943 I tried REPLACE(LTRIM(REPLACE(store_id,'0',' ')),' ','0') but it trims leading zeros for the first value alone. How to get all storeIds of an employee without leading zeros in a sql query? Is it possible?...

SQL trimming syntax error

mysql,sql,syntax-error,trim
I've just finished 'SAM's Teach Yourself SQL in 24 Hours' book, and I've been given the task of listing which of our active site's "site_code" match their respective "site_path"s with the prefix '/var/www/html' removed. I've been stuck for the past hour or so trying to figure out what I'm doing...

Efficient way to trim() space characters off all Properties in a JavaScript Object as they are being set?

javascript,jquery,trim
This is a stripped down demo with the very basic needed to replicate what I need to do. In my JavaScript application I have a Click event on Project Task Records. When a Task is clicked on, I populate a JavaScript Object with data from the DOM related to the...

Removing start of char array at last occurrence of a character C++

c++,arrays,char,trim
I am looking for the best way to remove the start of a string until the last occurrence of a character. For example. I have a char array that contains the following: [Microsoft][ODBC SQL Server Driver][SQL Server]Option 'enable_debug_reports' requires a value of 0 or 1. Basically, I am looking for...

How to delete spaces In an 2D-Array in Java?

java,arrays,string,trim
I have a text file. I am reading it then placing it into a 2D-Array. There are spaces. I need to get rid of those spaces. But I can't use trim properly. Here is my code: while ((line = br.readLine() ) != null ){ char[] row = line.toCharArray(); line.trim(); int...

Remove '(' and text which follows from a string

php,string,replace,trim
Goal, to trim all text starting with the a left parenthesis '(' from a string. I've read through stack for the last hour, php.net, googled, I've tried using trim, ltrim, rtrim, strpos, preg_replace, etc. Everything that I have found so far has dealt with how to replace the text IF...

JvectorMap Trim data output

javascript,json,trim,jvectormap
I'm using JvectorMap to map carriers by state for easy editing the json data looks like this: { "states": { "2015": { "US-AK": [" Aenta", " Assurant", " ", " ", " ", " ", " "], "US-AL": [" Aenta", " Assurant", " ", " ", " Goden Rule", "...

'TRIM' or 'PROPER' in BigQuery

google-bigquery,trim
is there a way to normalize strings in BigQuery? My dataset looks like: Alfa Beta Alfa BETA alfa beta //with a space after 'beta' By now I can use lower or upper to normalize the letters but I don't know how to eliminate spaces before and after the text. Does...

Trim actions for all properties

c#,trim
I have a typical website with admin part where admin can add many different entities. I, as developer, have to trim each of them (to prevent enter entities like ' status name '. I do it i.e. in Validate method IValidatableObject interface: public class AddProjectViewModel : ProjectFormBaseViewModel, IValidatableObject { public...

Deleting unnecessary symbols from variable in Jmeter

variables,jmeter,trim,symbols,beanshell
I have variable as string in this view: ["564546","56454654","3123123","868987"] I need the script that deletes unnecessary symbols [ ] " and put it to another variable . (something like trim method) I assume it should be made in BeanShell pre-processor....