Questions tagged [text-manipulation]

Text/String manipulation is the term used to describe various operations applied to strings and/or text.

Text/String manipulation is the term used to describe various operations applied to strings and/or text. Often used with Regex or replace functions, concatination, etc.

237 questions
0
votes
4 answers

Another preg_replace question!

Ive got a string that are words bunched together and I need to seperate them, and every word that ends in 'A' should probably be on a new line, item onea second itema third I also need to check if the word ending in 'A' should actually end in 'A'…
bluedaniel
  • 2,079
  • 5
  • 31
  • 49
0
votes
0 answers

PHP text manipulation library

I am developing in a web application that its main function is text manipulation. As you know PHP even does not support Unicode internally. (There is some elementry solution, mbstring extension and u modifier in preg_*) Is there any library that can…
Handsome Nerd
  • 17,114
  • 22
  • 95
  • 173
0
votes
2 answers

How to use Python to find a string in a line and change the text n lines after the string

I need to find every instance of "translate" in a text file and replace a value 4 lines after finding the text: "(many lines) } } translateX xtran { keys …
0
votes
0 answers

jquery show more text based on container height

I looked for a plugin that truncates text and adds a (more) link to it based on container height not char limit of text. I couldn't find one. Looks like ill have to write one myself. The question need to answer is: Based on the width of a div, and…
mkoryak
  • 57,086
  • 61
  • 201
  • 257
0
votes
2 answers

How to trim text to certain length, full sentences?

I'm looking for a solution for trimming an unknown text to certain length. Keeping only full sentences. So text like this "Were you born 1. 3. 1987 in Prague? Štěpán Jr. lives there for 3 years now! " should be turned into "Were you born 1. 3.…
Tomáš Fejfar
  • 11,129
  • 8
  • 54
  • 82
0
votes
2 answers

php substr and text manipulation

I would like to take this data: questionX Where X is any number from zero to infinity. And subtract the text question from the field, and save just the number. I was toying with substr($data, 0, 8) but haven't gotten it to work right, can somebody…
Shackrock
  • 4,601
  • 10
  • 48
  • 74
0
votes
1 answer

Get the multiple string between two strings in a file

I have a ".txt" file where I have a string say "Function supported" and "Function Description" I have multiple lines between these two string starting with say "-". How to get each line and apply some changes on it? To get the substring I can do…
user1389673
  • 365
  • 1
  • 3
  • 6
-1
votes
2 answers

How to extract the longest words alphabetically in a text in Python?

I have a problem as I am a total beginner to Python, now learning text-manipulation. I am trying to extract the five longest words in a text, create a list with those items and order them alphabetically. Then I need to print the results. How do I…
clarkens
  • 1
  • 1
-1
votes
2 answers

iterate over a series of strings and replace spaces between two numbers with zeros

I have a file such as this: ME45 P 1311 41130 1.253 ME39 P 1311 41130 7.700 ME38 P 1311 41130 7.776 ME37 P 1311 41130 8.285 ME36 P 1311 41130 8.689 ME30 P 1311 4113010.252 ME26 P 1311 4113010.486 ME29 P 1311 41130 9.598 ME28 P 1311…
dex10
  • 109
  • 1
  • 9
-1
votes
1 answer

How do I remove the last character from a string only when it is a comma?

I have: String test = "Hello,"; String test2 = "Hello"; I want to replace the last character if it is a comma with an empty string. I currently have: String var = test.Remove(str.Length - 1, 1) + ""; String var = test2.Remove(str.Length - 1, 1) +…
David
  • 25
  • 5
-1
votes
2 answers

How can I output the number on the nth position in a string?

Using bash, lets say i have the following string string="Same bought 5 bananas, 12 apples, 2 peaches and 16 oranges" How can I trim everything except the nth number. In this case I want to output 12 which is the second number in the string. How can…
Bret Joseph
  • 401
  • 3
  • 13
-1
votes
2 answers

Inserting comma at predetermined positions in txt file

I have a file that comes as follows: 10030004 10300048 10919013 That is a txt file which contains data and each new line is a new observation. This file comes along with a document stating that for instance: Variable: A Start: 1 Length: 3 Variable:…
Daniel2805
  • 77
  • 1
  • 8
-1
votes
2 answers

Replace text place holders with Regular Expression

I have a text template that has text variables wrapped with {{ and }}. I need a regular expression to gives me all the matches that "Include {{ and }}". For example if I have {{FirstName}} in my text I want to get {{FirstName}} back as a match to…
Pouyan
  • 2,849
  • 8
  • 33
  • 39
-1
votes
2 answers

How do I print text in italics in Python?

I am writing a program that is supposed to take entries and return an APA citation in a specific modified form of APA. I have realized that I will need to print only certain parts of the text in italics. Right now, my program just does an input…
Mike Delmonaco
  • 314
  • 4
  • 13
-1
votes
3 answers

Compare one field, Remove duplicate if value of another field is greater

Trying to do this at linux command line. Wanting to combine two files, compare values based on ID, but only keeping the ID that has the newer/greater value for Date (edit: equal to or greater than). Because the ID 456604 is in both files, wanting to…
4141n
  • 3
  • 2
1 2 3
15
16