Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #1037242 // pine_replaceInputDefault

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (11535L/64K).

svoid pine_replaceInputDefault(LS tok, S varName, O newDefaultValue) {
  int i = jfind(tok, varName + " = input.<id>(");
  if (i < 0) ret;
  int iOpen = indexOf(tok, "(", i);
  int iDefault = iOpen+2;
  int iEndDefault = indexOfAny(tok, iDefault, ",", ")");
  replaceTokens_reTok(tok, iDefault, iEndDefault, str(newDefaultValue));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1037242
Snippet name: pine_replaceInputDefault
Eternal ID of this version: #1037242/2
Text MD5: a9b8198c433dafee68a6fe6cfa9c24d3
Transpilation MD5: e3a18e9aa93cb19b30e3ed238a3b5905
Author: stefan
Category: javax / pine script
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-08-06 15:32:05
Source code size: 339 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 152 / 215
Version history: 1 change(s)
Referenced in: [show references]