How to remove text into the editor at current selection in ckeditor5? - ckeditor5

let say i have this string
a quick brown fox jumps:
I want to remove colon : from that string
there is a method to remove called "write.remove"
but I don't know how can I use this

Related

Find & Replace Long Blocks of Text (Microsoft Word) without losing the styles

I would like to find and replace long blocks of text with line breaks in Microsoft Word. With ctrl+h I am able to find and replace text up to 255 characters. But if I want to search for a text which has line breaks, ctrl+h does not work. So, I looked in the internet and found the following code which helped me to delete the copied text from the document. But the Macro is also removing the styles in the document.
Here is the code I took from https://answers.microsoft.com/en-us/msoffice/forum/all/find-replace-long-blocks-of-text-microsoft-word/2fa77e32-9085-4c74-9d11-04d86829442f
Sub Remove_text()
Dim strText As String
Dim strReplacement As String
strText = Selection.Range.Text
strReplacement = "" 'Use this command to delete the instances of the selected text
'strReplacement = InputBox("Enter the text to be used for the replacement", "Find and replace long text")
With ActiveDocument.Range
.Text = Replace(.Text, strText, strReplacement)
End With
End Sub
For e.g. if I run the macro with the fallowing words in a word document and run the macro after selecting two words, the resultant text will be with all the words in bold characters.
Before
Cow
Rabbit
Ducks
Shrimp
Pig
Goat
Crab
Deer
Chicken
Seagull
Ostrich
After
Cow
Rabbit
Ducks
Shrimp
Pig
Goat
Crab
Deer
Chicken
Seagull
Ostrich
If I run the macro with the fist word in the list without bold and italics all the words are becoming plain as shown below.
Before
Cow
Rabbit
Ducks
Shrimp
Pig
Goat
Crab
Deer
Chicken
Seagull
Ostrich
After
Cow
Rabbit
Ducks
Shrimp
Pig
Goat
Crab
Deer
Chicken
Seagull
Ostrich
The above list is just an example. The same thing also happens in a large document. In that document all the styles will be replaced with the first word's style. So the styles of the whole document is depending on the first word's style. Can someone help me to remove the text with line breaks at the same time preserve the styles?
What you are describing in your comments has nothing to do with the format of the document. Deleting text does not change the document's format. Deleting Section breaks, though, can do so drastically.
I note that you have radically changed your description of the problem since first posting it and receiving feedback. Clearly, you've wasted everyone's time by giving a poor problem description in the first place.
The examples in your updated description clearly show that you're replacing content, not merely deleting it. In that case, to preserve the formatting, you need to limit your replacement content to the same range as whatever exhibits the format of the content you want to replace. Either that, or you must type and format the replacement content exactly how you want it to appear, then copy it to the clipboard and use ^c for the replacement expression.

Find all bold text and insert brackets before and after it

I'm newbie in VBA. I would like to find all bold text and insert brackets before and after it.
For example, Before: This is bold text
After: {This is bold text}
I'm using MS Word
You don’t need to use VBA; Word’s UI can do it directly with Find and Replace:
Leave the “Find what” box empty, but press Ctrl-B to specify Format: Font: Bold. (You can also click the More >> button to access the Format drop-down button and select Bold from the Font dialog.)
In the “Replace with” box, type ^& (or you could type the asterisk, use the Special drop-down to choose “Find What Text”, and type the 2nd asterisk).
Click Replace All.
Each instance of bold will be “replaced” by an asterisk, the found content (i.e. the bold letter(s)), and another asterisk.
Edit: The ^& is a special code to represent “Find What Text” as a Replace option in Find and Replace. The “Special” button presents a list of available options by name for both the Find and Replace boxes, and will insert the code when you make the selection.

Highlight in Lucene with certain numbers of surrounding words

I want to make a highlight in Lucene which beside the highlighted word it also returns its context which consists of a certain number of words surrounding the searched term. For example, if the content of a document is The quick brown fox jumps over the lazy dog, the searched word is fox and the desired number of surrounding words is 2, the result should look like this quick brown <B> fox </B> jumps over

Copy 5th word of the "rich text box1" to "textbox1.text"

The richtextbox1 contains 8 words "The brown fox jumped over the lazy dog". I want to copy the 5th word of the richtextbox1 to textbox1.text when the button1 clicked.
can this be done using find method such as find(character, start integer, end integer) etc ie. finding "empty" (space) character and read the characters until second "empty"(space) character found. or any other better method?
I would suggest using the split function for this scenario.
e.g
textbox1.text = richtextbox1.text.split(" ")(4) 'This is for the 5th word.
You may also use the Mid function indeed. Chech it out from
https://msdn.microsoft.com/en-us/library/05e63829(v=vs.90).aspx
Updated
textbox1.text = Mid(richtexbox1.text, 1, 5)

controlP5 textfield contents. Processing

I have a sketch in processing I am working on which contains a textfield and a submit button. When the submit button is pressed, a file with is created using the name given in the textfield. I want to make sure something has been entered into the textfield when the submit button is pressed, however, it appears that by default the string is not empty or contain white space and is not caught by if statements.
Is there any simple way to check that something has been entered in the text field without needing to resort to something like regex?
I am not sure I understood whether by default your string is not empty and also does not contain white space (which would make it an odd example). The best possible check I can think of is to trim whatever the entered string is and then check if it is empty:
if(enteredString.trim().length() > 0) println("The string is valid");
the trim() method trims leading and trailing spaces, so if there are only spaces they will be removed making the string empty. Also, since you are saving files you might want to check for invalid characters. With Processing (Java) you don't necessarily have to resort to regex since you can do stuff like these:
String s = "ashd/ah";
println(s.contains("/"));
println(s.replace("/","-"));
which will print:
true
ashd-ah