make the content of a button in keyboard empty - react-native - keyboard

I am using numeric keyboard in my program and I need to set one of the buttons on the keyboard empty - "." button should not exist, I just need numbers. How I can do it?
Thanks in advance.

If you are using a native keyboard, you cannot do this.
If you still want to do it, maybe you should create your own keyboard or look for a library with a customizable one.

If you want to use the native keyboard but disable the effect of non-numeric buttons, you could do something like this:
handleTextChange(text) {
// remove non-numbers using regex
text = text.replace(/\D/igm, '')
this.setState({number: text})
}
...
<TextInput
value={this.state.number}
keyboardType="numeric"
onChangeText={this.handleTextChange.bind(this)}
...
/>
Basically you're using the onChangeText call to catch the text change and then using the "not digit" regex selector \D you replace it with empty string.

Related

" button instead of < in my external keyboard

Recent weeks I was using my keyboard with Turkish language.
I would like to write " when I clicked the top left button, under the escape key. I don't want to write < character.
How to solve it?
You would have to have a way of changing the keyboard bindings. This might be possible depending ont he manufacturer.
Other options would be to create a short cut for the symbol you want. There are three double quoates I know of and if this is for coding you will want to make sure to pick the right one. But say you want the straight double quotes, then you can create a short cut that writes out the symbol.
Alternatively you can you can use the Alt codes tp produce it. Like Alt 0148 for "
I have solved the problem. I changed my keyboard type without knowing it. So corrected it on System Preferences -> Keyboard -> Change Keyboard Type.

how to make the code in Sublime text 3 in one line?

when I code using sublime the code breaks up (without hitting enter) when it goes to the end of the frame of sublime software ... I want the code to be in one line.
Here is what I want ... see this image to know what I mean
Here is what I don't want ... see this image to know what I mean
I want the second image to be like the first one so when I code the code should be in one line unless I hit enter
All you need is click on menu View -> Word wrap, i.e. uncheck it

Any way to surround selection with braces automatically on typing {, using VS2012 and ReSharper 8?

I know I can make a selection and use the ReSharper action-menu to surround with braces, or use one of the many "Surround with..." keyboard shortcuts.
What I am looking for is a way to do the following (aka the laziest possible way):
Select some code
Press {
The selected text is now surrounded with braces.
This works in e.g. Xamarin Studio (for [,{,( braces).
Is there any way to achieve this in Visual Studio, either using built-in functionality or a plugin?
You should be able to write a resharper plugin to do it. You can register a typing assist handler for a particular character (such as '{') by calling ITypingAssistManager.AddTypingHandler. Your handler should look to see if the document has a selection, and modify the document to insert the open and closing character around the selection contents.
The only problem might be precedence - the '{' character will already have a handler for C# documents. Adding another handler will add it to the end of the chain of handlers, and the existing handler might jump in first. In which case, you could register yourself with ITextControlManager.AddTypingHandler, which is what TypingAssistManager does, but it allows specifying a priority, so you can be called before TypingAssistManager.
As ever, point dotPeek at the ReSharper bin folder and start spelunking for usages of AddTypingHandler, or look at the implementation of TypingAssistManager.

How to write superscript / upper index in Visual Studio?

It is possible, but I don't know how is it done.
Use the Windows Charmap.exe applet. In the Font combobox select a font that has a lot of glyphs, Arial Unicode MS is a very good choice. Tick the Advanced view checkbox and type "super" in the Search box. The grid will show all superscript glyphs, select and copy from that and paste into your source code.
Or copy/paste one of these: ¹²³⁴⁵⁶⁷⁸⁹⁰
Subscript characters: ₀₁₂₃₄₅₆₇₈₉
Adding more details to complement #HansPassant's answer. Other frequently used sets which can be used as is by copy/paste:
Superscript small case letters: ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘᵛʷˣʸᶻ
Subscript small case letters: ₐ ₑ ₕ ᵢ ⱼ ₖ ₗ ₘ ₙ ₒ ₚ ᵣ ₛ ₜ ᵤ ᵥ ₓ
If you're wondering why few letters are missing in above series then please read below posts:
Where are the other letters in this Unicode block?
Why does the unicode Superscripts and Subscripts block not contain simple sequences of all letters?
Why is there no character for "superscript q" in Unicode?
Since there is a tag visual-studio-2012, I assume you are running Windows. There is a great opensource program called WinCompose, which allows to use easy-to-remember and intuitive shortcuts for a huge amount of Unicode symbols, including numerical super- and subscripts. Every shortcut is invoked via a Meta key (e.g. Right Alt), for example:
Meta + ^ + 1 gives ¹;
Meta + _ + 9 gives ₉.
WinCompose also supports search, can be run in background, and eliminates tedious procedure of calling Character Map with subsequent copy-pasting or remembering the Unicode charsets (but the latter are also listed):
P. S. I'm not affiliated with this software by any means. Just a happy user.
One more way for WPF users,
<TextBlock >
<Run>x</Run>
<Run FontSize="8" BaselineAlignment="TextTop" >2</Run>
</TextBlock>
Change BaselineAlignment to TextBottom if you want to use as subscript.
In VsCode download the extension "Fast Unicode Math Characters".
The hotkeys for ₂ is \_2.
The hotkeys for ² is \^2.
Looks like there are some simple tags that you can use to make any text superscript/subscript. The superscript tag is <sup> and the subscript tag is <sub>.
https://www.w3schools.com/tags/tag_sup.asp
use (Ctrl + Shift + P) command to apply superscript and subscript in Visual Studio.
This is how usually I tend to do it on Mac.
In the VS code, hit (Control + Command + Space) to bring up the Character selector and search for 'superscript' in the search box.
Click on required superscript and add it. And here is the result. Screenshot are from the VS code only.
This approach should work across most of the apps in the Mac. Tested in MacOS 12.5. (Monterey)
There are several solutions. Personally, I simply formaat the label text in Word, use a screen capture and save it as an image that I use with a label.

Resharper completion without overwriting existing code

In Resharper when I go back to edit some existing code.. eg. wanting to insert a String.Format into this code:
<td>
<%= Html.Encode(item.Address) %>
</td>
I move the cursor to before 'item' and type in 'String.F', getting Resharper's intellisense completion list that includes the 'Format' method.
However if I press TAB then it replaces 'item' with '.Format()'
Is there a way to use completing without replacing the existing text?
Stumbled upon using Enter instead of TAB to choose from the completion list. That does exactly what I want. It surrounds (in this case) 'item.Address' with the String.Format( .. ).
There are two techniques you can use.
The first is to use the Enter key, the second is to pop a space between where you are going to start typing and the next bit of code, which will prevent the next bit of code from being overwritten.
There is an actual setting now to disable this (annoying) behavior.
Go to the Options dialog (Menu -> Resharper -> Options).
In this Options dialog go to Environment -> IntelliSense -> Completion Characters.
Here you can set the Tab behavior to Insert instead of Replace.
Screenshot of Options
Resharper documentation about Completing Characters
This is an addition to the answer in 2010, for everyone that reaches this post via populair search engines ;)
You could also use the String.Format surround template but you may have to map a hotkey to it for easier access.
The keyboard command you want to use is called: Resharper_ForceCompleteItem. So if you go into Visual Studio's Tools > Options > Environment > Keyboard you could assign a keyboard shortcut there. Not sure if it would be possible to use Tab, though.

Resources