Skip to main content
Home
Lepton
Little sharing more harvest

Main navigation

Show — Main navigation Hide — Main navigation
  • Home

bash 判断字符串

Submitted by lepton on Wed, 05/11/2016 - 16:24

Tags

  • bash

判断字符串是否为整数

[[ "${str}" =~ ^-?[[:digit:]]*$ ]]  //正则表达式 不能加引号

expr match "$str" "^-\?[0-9]*$"

判断字符串 包含 123

[[ "${str}" == *"123"* ]]

  • Read more about bash 判断字符串
  • Add new comment

osx获取 键盘 鼠标 输入

Submitted by lepton on Tue, 05/10/2016 - 17:49

Tags

  • osx
  • cocoa

获取osx下的键盘输入

NSKeyDown事件需要 申请权限

(System Preferences → Security & Privacy → Accessibility)

 

    NSDictionary *dict=@{(__bridge NSString *)kAXTrustedCheckOptionPrompt:@YES};
    BOOL istrue=AXIsProcessTrustedWithOptions((__bridge CFDictionaryRef)dict);
    NSLog(@"%d",istrue);

方法1 cocoa

  • Read more about osx获取 键盘 鼠标 输入
  • Add new comment

Pagination

  • First page « First
  • Previous page ‹ Previous
  • Page 1
  • Page 2
  • Page 3
  • Page 4
  • Page 5
  • Current page 6
Subscribe to

Recent content

  • mysql backup
    2 years 1 month ago
  • mysql upgrade data
    2 years 1 month ago
  • backup
    2 years 1 month ago
  • gentoo simple install
    2 years 9 months ago
  • ca sign cert
    2 years 10 months ago
  • time machine backup to samba
    2 years 10 months ago
  • expect auto input message for cmd
    2 years 10 months ago
  • Send input str direct to tty
    2 years 10 months ago
  • python http server support ipv6
    2 years 10 months ago
  • WireGuard connect
    3 years ago

Recent comments

  • Thanks, A good amount of… 30 seconds ago
  • Very good content, Cheers… 31 seconds ago
  • strattera caps 1 minute 36 seconds ago
  • Mucopus ljx.zwba.leptonstar… 1 minute 45 seconds ago
  • Kifybu https://ramip.ink/ -… 2 minutes 42 seconds ago
  • Stone pid.iwsx.leptonstar… 4 minutes 8 seconds ago
  • A uml.zwzf.leptonstar.com… 4 minutes 13 seconds ago
  • Asian rcc.okep.leptonstar… 4 minutes 35 seconds ago

Footer menu

Show — Footer menu Hide — Footer menu
  • Contact