행위

"제니퍼 물음표(?)를 :1 형태로 변경"의 두 판 사이의 차이

DB CAFE

(제니퍼 물음표(?)를 :1 형태로 변경)
1번째 줄: 1번째 줄:
 
=== 제니퍼 물음표(?)를 :1 형태로 변경 ===
 
=== 제니퍼 물음표(?)를 :1 형태로 변경 ===
<source lang=python>
+
==== sublime 이용 ====
def replace_characters(string):
+
You can use Increment Selection.
    replacements = {
+
Just press Ctrl+Alt+I over multiple selections of numbers.
        "?": ":1",
 
        ",": ":2",
 
        "!": ":3",
 
        ".": ":4"
 
    }
 
    for char, replacement in replacements.items():
 
        string = string.replace(char, replacement)
 
    return string
 
  
def format_string(string):
+
You will need Package Control first. All of this shouldn't take more than 30 seconds to install.
    formatted_string = ""
 
    split_string = string.split(",")
 
    for i, s in enumerate(split_string):
 
        s = s.strip()  # 문자열 앞뒤 공백 제거
 
        formatted_string += f"{s}:"
 
        if i < len(split_string) - 1:
 
            formatted_string += f"{i+1}, "
 
        else:
 
            formatted_string += f"{i+1}"
 
    return formatted_string
 
  
# 사용 예시
+
Steps:
input_string = "?,?,?,?"
+
 
replaced_string = replace_characters(input_string)
+
Install Package Control.
output_string = format_string(replaced_string)
+
Open Command Palette: Ctrl+Shift+P (Windows/Unix) / Command+Shift+P (Mac).
print(output_string)
+
Type Install Package Control and click to install.
</source>
+
Install Increment Selection package.
 +
Open Command Palette again.
 +
Type Package Control: Install Package, click on it and wait a short period.
 +
Type Increment Selection and click on it to install.
 +
Select multiple numbers and press Ctrl+Alt+I (Windows/Unix) / Command+Control+I (Mac).

2023년 6월 27일 (화) 12:54 판

thumb_up 추천메뉴 바로가기


1 제니퍼 물음표(?)를 :1 형태로 변경[편집]

1.1 sublime 이용[편집]

You can use Increment Selection. Just press Ctrl+Alt+I over multiple selections of numbers.

You will need Package Control first. All of this shouldn't take more than 30 seconds to install.

Steps:

Install Package Control. Open Command Palette: Ctrl+Shift+P (Windows/Unix) / Command+Shift+P (Mac). Type Install Package Control and click to install. Install Increment Selection package. Open Command Palette again. Type Package Control: Install Package, click on it and wait a short period. Type Increment Selection and click on it to install. Select multiple numbers and press Ctrl+Alt+I (Windows/Unix) / Command+Control+I (Mac).