當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


Processing Client.readStringUntil()用法及代碼示例


Processing, 類Client中的readStringUntil()用法介紹。

用法

  • client.readStringUntil(interesting)

參數

  • client (Client) 客戶端類型的任何變量
  • interesting (int) 指定用於標記數據結束的字符

返回

  • String

說明

readBytesUntil()readString() 的組合。如果找不到您要查找的內容,則返回 null

例子

// Creates a client that listens for input until it 
// gets a linefeed character,and puts the bytes it gets 
// into a byte[] buffer.

import processing.net.*; 
Client myClient; 
String inString;
byte interesting = 10;

void setup() { 
  size (300, 100);
  // Connect to the local machine at port 10002.
  // This example will not run if you haven't
  // previously started a server on this port.
  myClient = new Client(this, "127.0.0.1", 10002); 
} 

void draw() { 
  if (myClient.available() > 0) { 
    background(0); 
    inString = myClient.readStringUntil(interesting); 
    println(inString); 
  }
} 

相關用法


注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 Client.readStringUntil()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。