Is it possible to quick-select the first/next entry by typing the letter this entry starts with?
EXAMPLE: Given following combobox entries:
Green
Blue
Red
Pink
Setting focus on the combbox and typing B shout select "Blue".
Related
I have some cells with long strings.
I want to truncate the cells within a column, so that only word(s) before a semicolon are maintained. For example, if I have a cell with the string blue house; with green garden I want to only maintain the words before the semicolon, so it would become blue house
Thank you!
If you just want to delete the semi-colon and everything after it then this is a simple pattern that replaces such instances with the empty string: "".
blue <- c('blue house; with green garden')
gsub(";.*$", "", blue)
[1] "blue house"
The previously accepted answer uses a conditional/look-behind and a capture class, both useful concepts, but a bit complex for this simple task.
blue <- c('blue house; with green garden')
gsub('(;*?);.*', '\\1', blue)
[1] "blue house"
appears to work. When using the very nice regex101.com, and you get something to work, remember to add another \ to working examples when you use them in your terminal or RStudio.
I have a label labelSign which is showing the +ve or -ve sign.
and I have another label labelValue and the text color of the label is depending on the text of labelSign.
This code is ok if there are two kinds of colors:
labelValue.textFillProperty().bind(Bindings.when(labelSign.textProperty().isEqualsTo("+ve")).then(Color.GREEN).otherwise(Color.RED));
How to handle if there are 3 cases of labelSign: +ve, -ve and empty and painting the text of labelValue as BLACK if the labelSign is empty?
Use Bindings.createObjectBinding to create a binding with the text property as dependency.
private static Color textToColor(String text) {
...
}
labelValue.textFillProperty().bind(Bindings.createObjectBinding(() -> textToColor(labelSign.getText()), labelSign.textProperty());
This allows you to use an arbitrary algorithm to determine the color based on the text. An update happens everytime one of the dependencies (in this case the text property of the Label) is updated.
On the other hand you can set an arbitrary text color without changing the displayed result, if the text is empty (= empty string)...
When I highlight any string of text in the R Studio console a rectangle is drawn around all other occurrences of this same string of text. How do I advance to the next occurrence of this arbitrary string of text? I'd like the keyboard shortcut.
CTRL-F3 is the closest shortcut I know. This takes the selected string of text, drops it into the Find dialog and jumps to the next occurrence (keep pressing CTRL-F3 to cycle through)
If you would like to move to the next occurrence of a word/variable and select it while also keeping the original selected, this command exists but does not have a default shortcut assigned to it.
The command is called 'Find and add next' (or 'Quick Add Next' in older versions). You can assign a shortcut to it by going into Preferences -> Code -> Modify_Keyboard_Shortcuts. I use Alt+Cmd+Right (on a Mac) as that is an unassigned key binding.
You can see bellow I have used the command twice to select three of the four instances.
On a Mac, I use command+f to call Find with a selected string and then use control+g to move onto the next match.
This needs to be over 30 characters, but only needs 2:
F3
Is there a way to find last comma with a string and replace it?
There are yellow, blue, green, orange fruits.
to
There are yellow, blue, green and orange fruits.
It would be very simple to find first comma:
substr(text, instr(text, '.'), 1) from table..
But I am looking for a dynamic solution to do it from behind.
If you reverse the string, then using 'instr' would work. You can write a custom function to reverse the string.
I'm using VIM in red hat 5, with the black background and green letters. However, I don't like the color schema for strings ("") nor reserved C++ key variables (int for example it is in dark green). Could someone please give me some suggestions how could I change those default colors?
I know, for example, to change the comment collor I do
hl Comment ctermfg=yellow
Type :hi, then hit Enter. A list of highlighting definition will show.
The C++ groups start with c.
int is a cType. Try:
:hi cType ctermfg=yellow
You can put your custom highlighting commands into vimrc(after colorscheme name and syntax on).
If you'd want to customize your current colorscheme, check out this Vivify. Adjust the color editor to your specific language and then save the colorscheme file into your vimfiles.