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

Determining if a String begins with an Alphabetical Char and Contains Numerical Digits

I am making an infix evaluator in which the legal tokens include: +, -, *, /, (, ), non-negative integers, and any String that begins with one or more letters and ends with one or more digits. I am trying to find the most efficient way to determine…
Jonathan
  • 589
  • 1
  • 13
  • 23
-1
votes
3 answers

Use endswith() to check if a string in one list ends with a string from another list?

I need to check if items within a list is listed at the end of a string in another list, preferably by using endswith() somehow but I'm not really sure how to solve it with just this method and not let it depend on length of the other list etc.. For…
-1
votes
3 answers

having some difficulty with some code around strncmp in C

having some difficulty with some code around strncmp in C just wondering if there is someone that ran into the same problem has me #include #include #include #include int endsWith(char* longStr, char*…
-1
votes
3 answers

How to efficiently check if a folder contains a list of files?

I want to check if all of the files (B01:B12) are present in a certain folder. If that is the case it should return True. I know the end of the filenames, but the beginning can vary. Currently, I have the following code. It works, but I feel that it…
Niek
  • 51
  • 8
-1
votes
1 answer

Find if a substring is enclosed within a string

I would like to know if there exists a direct way of knowing whether a substring given is present within a string strictly inbetween (i.e) not startswith and not endswith but somewhere contained within the string. substring = "trees" input1 =…
PIngu
  • 115
  • 1
  • 10
-1
votes
33 answers

The replace_ending function replaces the old string in a sentence with the new string, but only if the sentence ends with the old string

The replace_ending function replaces the old string in a sentence with the new string, but only if the sentence ends with the old string. If there is more than one occurrence of the old string in the sentence, only the one at the end is replaced,…
Nithin
  • 137
  • 1
  • 1
  • 6
-1
votes
1 answer

Find words that startswith() and endswith() in a DataFrame column

Having a dataFrame column hosting a compound name (school name), I am interested to go over each word of the school name and find its position with respect all the dataFrame column. I used the following approach: Create another column which is a…
John Barton
  • 1,581
  • 4
  • 25
  • 51
-1
votes
1 answer

If condition with startswith and endswith error

I have the split the data that starts from ( and ends ) x contains data likes (33)Knoxville, TN,,,(1)Basking Ridge, NJ location = "".join(x.split("()"))[4:] in this split logic what condition should I gve [3:] ?? if name: if…
Jeyasri
  • 13
  • 3
-1
votes
2 answers

Python endswith() function, without the built-in function

I need to make the endswith() function without using the built-in function in Python. I wanted to know if there is any way i could do it shorter and easier? I'm sure there is, my way is really complicated. string = "example for endswith" find =…
Vida
  • 11
  • 1
-1
votes
5 answers

Ends-with and Starts-with in if statements: Python 3

I am new to python and I have to create a program that validates a DNA sequence. (background on DNA sequences really quick) in order to be valid: • The number of characters is divisible by 3 • The first 3 characters are ATG • The last 3…
user3230395
  • 11
  • 1
  • 1
  • 2
-2
votes
2 answers

How to find if an word/string ends with a subword from an array using endswith()?

I have a set of characters, for example: array = ['abc', 'adc, 'cf', 'xyy'] and I have a string: my_word = 'trycf' I want to write a function that check if the last elements of my_word contain an element of my array. If this is the case, I want to…
Mas A
  • 207
  • 1
  • 11
-3
votes
1 answer

How to loop through a list of elements and verify if one ends with a specific letter in Java

How would I go about looping through a list of elements and finding out whether the list ends with a specific letter? My code keeps breaking on the if line saying stale element. Any suggestions? My code is as follows: boolean…
-4
votes
2 answers

Find text starts with "Column" and ends with any number (e.g. "100") and nothing between the two, using C#

I want to find texts (using C#), in a string, that starts with the word "Column" and ends any number (for example "100"). In short, I want to find: Column1 Column100 Column1000 But not to find: Column_1 _Column1 Column1$ I can't find a way to do…
Murat
  • 35
  • 7
1 2 3
8
9