Questions tagged [ends-with]

A common function to determinate whether the end of this string instance matches the specified string.

Determines whether the end of this string instance matches the specified string.

See also the documentation for .Net, Java or Python. There are also workaround for languages like JavaScript and c++.

133 questions
0
votes
1 answer

Powershell Get Value from string knowing it always starts with a string and ends with a string

I am running a SQL query and need to pull a machine name out of the field. The results have multiple entries separated by semicolons. I only care about the value for Server=PCName\SQL_Instance. The values I'm working with look…
0
votes
0 answers

python shutil.move [Errno 2] No such file or directory: '116431103.jpg'

hello guys i try to move all pictures to the folder and i getting an error can you please help me, i have been 25hours looking for the solution on internet Without success, please see the screen import shutil import os class DFO_engine: def…
0
votes
2 answers

How to assert that a text ends with digits in protractor

I would like to assert in Protractor that a link text is composed by the following way: text-1 (where text is a variable, and the number can be composed by any digits). I tried the following: browser.wait( ExpectedConditions.visibilityOf( …
0
votes
1 answer

String endswith() in Python

I have a pandas dataframe as below.I want to create list of columns by iterating over list called 'fields_list' and separate out lists which ends with the list in 'fields_list' import pandas as pd import numpy as np import sys df =…
Shanoo
  • 1,185
  • 1
  • 11
  • 38
0
votes
1 answer

Differences between using python endswith and substring

I've come across a situation where two solutions are proposed. Let's say I have a string, "foo bar" as an input and I need to check that it ends in "bar". One person's solution is this: is_bar = lambda x: x[-3:] == "bar" The other person's solution…
NuclearPeon
  • 5,743
  • 4
  • 44
  • 52
0
votes
1 answer

Trying to get from

Both the below cases are not working. I want to extract from a text file a certain part that I can choose by specifying the start of the line and end. case looks like this: using (StreamReader reader = new…
Paradente
  • 3
  • 4
0
votes
2 answers

Python get first and last value from string using dictionary key values

I have gotten a very strange data. I have dictionary with keys and values where I want to use this dictionary to search if these keywords are ONLY starting and/or end of the text not middle of the sentence. I tried to create simple data frame below…
sharp
  • 2,140
  • 9
  • 43
  • 80
0
votes
3 answers

Is there a .endswith that can open files with suffix variations after (".html?") (e.g. go through ".html?p=1209401", ".html?p=92030", etc.)

I'm trying to create an html parser that will take all the html and htm files in a folder and its subfolders and take out all html tags and export CSV and TXT files. I have a folder with subfolders that have numerous files in them that end with…
Youssef A
  • 71
  • 1
  • 9
0
votes
1 answer

r dplyr combining mutate_at, vars(ends_with), ifelse, !is.na

Hi I have 10 variables with the same ending and I am trying to use mutate_at to create a new variable based off of data in those variables and assign it back to the dataframe. If any of the variables with the ending "xyz" has data (i.e. is not NA)…
AstraOK
  • 49
  • 9
0
votes
3 answers

How can I get number from String with endWith function effectively and with clear code?

I have inputs like "Test1","Test2"... and I just try to find end number in these strings. I wrote below code but I don't like it. How can I improve this code? Is there any advice? private int getEndNumber(final String str) { if…
Sha
  • 921
  • 17
  • 46
0
votes
0 answers

python os.walk file.endswith is searching case sensitively. How can I remove this restriction?

I have the following: for root, dirs, files in os.walk(pathToSearch): for file in files: if file.endswith(fileTypeToSearchFor): It works well, it searches through and brings back files. What I'm struggling with though…
robster
  • 626
  • 1
  • 7
  • 22
0
votes
1 answer

Get XML node value using .EndsWith

I have the following XML Name false open 10am 6pm
IcantCode
  • 11
  • 1
  • 7
0
votes
1 answer

Why isnt my file recognised when using endswith()

I have written a script that pulls various builds from a server. once I have the build I need, I want to send it to the correct extracting function but first I need to determine what the file endswith (7z, zip, bz2 etc) but my function doesn't seem…
Daniel_88
  • 11
  • 4
0
votes
1 answer

How do I remove a character of strings in a list if it ends with (character)?

Hello I am trying to remove the Character '+' >>> a = ['eggs+', 'I don't want to remove this ', 'foo', 'spam+', 'bar+'] >>> a = [i[:-1] for i in a if i.ends with('+')] >>> a ['eggs', 'spam', 'bar'] >>> why are "I don't want to remove this" and…
user9886033
0
votes
2 answers

How to use function ends-with in selenium?

I look up the information that lxml does not support xpath2.0 so that it can't use ends-with, so selenium can't use ends-with how to use it or replace ends-with. thank you very much indeed!!! HTML sample wwwww The…
jianyi
  • 151
  • 1
  • 3
  • 11
1 2 3
8 9