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
2 answers

Python: for loop not looping over all the files

I am trying to loop over some compressed files (extension '.gz') and I am running into a problem. I want to perform a specific action when the FIRST file ending in 'aa' is encountered - it can be a random one, it doesn't necessarily have to be the…
DaniB
  • 200
  • 2
  • 15
0
votes
3 answers

Is there a short way to check whether the user input ends with one of the elements in an array?

Is there a short way to find out whether the user input ends with (endsWith()) one of the elements in an array? I would like to check if the user input ends with one of the following suffixes: "ss", "ll", "tt". If the user input ends with one of…
Decapitated Soul
  • 283
  • 4
  • 14
0
votes
2 answers

Methods .endswith/.removesuffix) not removing suffixes

I am trying to remove suffixes but for some reason, it is not working. Code is: # Stemming suffix_list = ['-ed', '-ing', '-s'] for word in range(len(output)): # loop # range returns the sequence, len checks the lenght for…
0
votes
1 answer

Want to get desired Image path using os.walk in python

I have Folder Named A, which includes some Sub-Folders starting name with Alphabet A. In these Sub-Folders different images are placed (some of the image formats are .png, jpeg, .giff and .webp, having different names like item1.png, item1.jpeg,…
0
votes
1 answer

Is there an alternative to .endswith()?

I am trying to write an if, elif else clause, so that depending on the German word ending, we can see is it should go with der, die or das. Here is my code: word = input ("Enter word: ") if (word.endswith('er' 'ismus')): print ("der") elif…
e007q
  • 1
  • 1
0
votes
5 answers

Remove words from a list that end with a suffix without using endswith()

I want to write a python function that takes 2 parameters: List of words and Ending letters I want my function to work in such a way that it modifies the original list of words and removes the words which end with the "ending letters"…
yowhatsup123
  • 287
  • 1
  • 11
0
votes
1 answer

Find the number of occurences using .endswith in python

So for my assignment i have to scan a .txt file with almost 300k words and count the number of occurences where the word ends with 'er'. Here is the assignment: How many words in the text end in "er"? (NB! Here we are looking for the suffix "er" and…
0
votes
0 answers

How to make .endswith work in OS 11 chrome and safari?

const trimEnd = str => str.endsWith('/') ? str.slice(0, -1) : str; const filterWithValue = str => str.length; Why wouldnt this work on a OS Big Sur chrome or Safari browser, but on windows…
Vzupo
  • 1,388
  • 1
  • 15
  • 34
0
votes
0 answers

Why does R think all of my rows end in "e"?

I am trying to create a new column with information from another column. For example, I want "Neutrophil_A0Late" to have "Late" in a new column, and "Neutrophil_A0Peak" to have "Peak" in the new column. My current code is: gene_CNS <-…
0
votes
3 answers

how to start to search for suffixes from end of the strings

I am trying to take an input as 'democracy is overrated.'and returns 'democr _acy is underrat_ed' sentence= input() suffixes = ["acy","tion", "ate", "er", "fy", "ize", "able", "ible", "al", "esque", "ful", "ic", "ous", "ish",…
0phase
  • 11
  • 2
0
votes
1 answer

Tableau error message "expected end to match if at character 0

I am trying to clean some free form data in a SAGE database so that we can quickly group entries into our accounts by supplier and therefore improve our management reporting. I have written the following code: if contains([Narrative], "PA") then…
0
votes
3 answers

Conversion of string.endswith method into C

I am beginning a personal project of converting an interpreter written in python into C. It is purely for learning purposes. The first thing I have come across is trying to convert the following: if __name__ == "__main__": if not…
David542
  • 104,438
  • 178
  • 489
  • 842
0
votes
1 answer

Fuction that reconize the female/male name

Hi i have to create a function that recognizes names- Polish names. Its quiet easy, bc 99% of female names ends with "a", where mens not, the only man name who ends with "a" is a “Bonawentura”. So to i tried create function that tooks in record that…
Panasiux2
  • 33
  • 1
  • 5
0
votes
3 answers

Python: How i Can print only a particular string starting with a specific character?

I have a text file which contains list of urls which looks like as…
0
votes
1 answer

Python file concating in the same directory usinf endswith but in order of the timestamp

I was trying to concat all txt files in the directory while removing first rows that weren't needed but I don't seem to find a way of contacting the files in the order of timestamp, the filenames also represent the needed order. import os switch =…
Sonya
  • 1
1 2 3
8 9