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
1
vote
0 answers

NO errors , console.log does not apprear before it was Uncaught TypeError: str.startsWith is not a function, str is not defined, now no errors

okay, so i am attempting to utilize data from the github api to make a randomized emoji "mood ring" type of thing. I noticed they have a list of images in their api for emojis. I was able to fetch from the api and stringify the data. now i am trying…
lizhavird1
  • 11
  • 1
1
vote
2 answers

Python: How to delete numbers in list

Python learner here. So I have a wordlist.txt file, one word on each line. I want to filter out specific words starting and ending with specific letters. But in my wordlist.txt, words are listed with their occurrence numbers. For example: food…
aydgn
  • 167
  • 1
  • 8
1
vote
1 answer

Powershell file row starts in 'String' and ends in 'Integer'

I am reading a text file where I need to filter out and perform some formatting if a row starts in a string and ends in a number. If i had known/fix values, I could use StartWith or EndsWith to filter this line. I tried using it as below but I guess…
Raheel R
  • 19
  • 4
1
vote
2 answers

How to use regexp in endswith() in conditional subsetting of pandas df column?

I want to use .endswith() or regexp in conditional subsetting of Sender name column in my dataframe. Dataframe df has two columns Sender email, Sender name which I will use to define a subsetting rule, to select all mail coming from a specific shop…
gregoruar
  • 345
  • 3
  • 14
1
vote
3 answers

What's wrong with my usage of String.EndsWith?

I can't figure out why EndsWith is returning false. I have the C# code: string heading = "yakobusho"; bool test = (heading == "yakobusho"); bool back = heading.EndsWith("​sho"); bool front = heading.StartsWith("yak"); bool other =…
jtsoftware
  • 521
  • 3
  • 14
1
vote
1 answer

dplyr::starts_with and ends_with not subsetting based on arguments

I want to select a number of variables based on thier names to transform them. The variable names all start with inq and end with 7, 8, 10, 13:15. This is not working for me... Apologies if this is obvious, but I cannot get it to work. Am I using…
Atanas Janackovski
  • 348
  • 1
  • 2
  • 12
1
vote
1 answer

Azure search: Doesn't give correct results with slashes and solutions given for "ends with" doesn't work

I need to fetch Azure search results from the folderPath field as below: "folderPath": "xxxxxxxxxxxxx_85ba0b45-xxxxx-4d83-a7e6-xxxxxx/abc" The results should be retrieved only from the above-mentioned folder. But search service also includes…
1
vote
1 answer

matching end of string

I'm looking for the best most efficient way to match the end of a single string with a value from a predefined list of strings. Something like my_str='QWERTY' my_lst=['QWE','QQQQ','TYE','YTR','TY'] match='TY' or match=['TY'] Under the…
Penicilina
  • 13
  • 3
1
vote
5 answers

C# String EndsWith Returning True Issue

I'm opening a file using the OpenFile Dialog and I want to confirm that the file is in an excel format. The file that I opened is "C:\Desktop\Distribution.xls", but both criteria of my if statement are evaluating to true. Is there another method…
Nicole
  • 104
  • 1
  • 2
  • 11
1
vote
5 answers

Shortest code for printing line startswith ['a', 'b'] and endswith ['y', 'z'] Python 3

For an assignment I have to print lines from a text that start with "W" and "Z" and end in "n" and "t" (so W-n, W-t, Z-n, Z-t combo's). I have a code now that works, but it seems a bit long and I was wondering if there is a way to shorten it? This…
1
vote
3 answers

How to see if a string ends with one of multiple characters

I have this statement: string_tokens[-1].ends_with?(",") || string_tokens[-1].ends_with?("-") || string_tokens[-1].ends_with?("&") I would like to put all the tokens (",", "-", "&") into a constant and simplify the above to ask, "does the string…
user7055375
1
vote
6 answers

Check if a string ends with a decimal in Python 2

I want to check if a string ends with a decimal of varying numbers, from searching for a while, the closest solution I found was to input values into a tuple and using that as the condition for endswith(). But is there any shorter way instead of…
SSY
  • 13
  • 4
1
vote
3 answers

Java String.replace() - replaces more than just the substring I specify?

As per this CodingBat problem I am trying to do the following: Given a string, if the first or last chars are 'x', return the string without those 'x' chars, and otherwise return the string unchanged. My code: public String withoutX(String str)…
alanbuchanan
  • 3,993
  • 7
  • 41
  • 64
1
vote
2 answers

Selenium IDE - can I use ends-with on drop down ID element

How can I use a Selenium IDE ends-with command on a drop down list ID which is dynamically generated but the last part remains the same? I've tried select id=ends-with(@id, "_gridDropDownList") label=A select …
Ralph737
  • 11
  • 4
1
vote
3 answers

php endsWith function fails on one server but works on another?

I have a script which is essentially a crawler to index news articles. The script works fine on one server (main http server), but I am trying to move it to a dedicated platform and one section will not function. The part that fails uses a simple…
1 2 3
8 9